我已经集成了SCORM1.2与我的游戏产生WebGL输出,如果我们玩的WebGL直接在浏览器它的工作很好,而不是在LMS工作。当我禁用它并在LMS中上传其加载时,发现游戏中包含的游戏运行脚本导致了问题(无法继续游戏运行,因为脚本被禁用)
在这个脚本中,我使用了GAF函数,从放置在StreamingAssets文件夹中的文件中提取数据,而不是使用任何WWW类。
游戏中包含SCORM资产包,https://www.assetstore.unity3d.com/en/#!/content/53523
不知道是什么功能限制了游戏的运行,能不能请你看看这个,然后给我反馈。
错误消息请查找附件。enter image description here
发布于 2016-08-30 13:37:05
使用WWW类https://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html访问StreamingAssets路径文件夹
public string filePath = Application.streamingAssetsPath + "/UserDetails.xml";
public string result = "";
void Awake ()
{
filePath = Application.streamingAssetsPath + "/UserDetails.xml";
}
void Start ()
{
StartCoroutine(userDetailsXmlPath() );
}
IEnumerator userDetailsXmlPath()
{
print (filePath);
if (filePath.Contains ("://") || filePath.Contains (":///")) {
WWW www = new WWW (filePath);
yield return www;
result = www.text;
print (result);
FetchUserDetails ();
} else {
result = File.ReadAllText (filePath);
print (result);
FetchUserDetails ();
}
}
public void FetchUserDetails()
{
XmlDocument userXml1 = new XmlDocument ();
userXml1.LoadXml(result);
XmlNodeList userList = userXml1.GetElementsByTagName ("user");
foreach(XmlNode userValue in userList)
{
XmlNodeList userContent = userValue.ChildNodes;
objUser = new Dictionary<string, string>();
foreach(XmlNode value in userContent)
{
objUser.Add (value.Name, value.InnerText);
}
userFullDetails.Add (objUser);
userCountInXml = userList.Count;
userId = new string[userList.Count];
questionSetOfUser = new string[userList.Count];
}
AssignUserXmlValuesToArray ();
}
https://stackoverflow.com/questions/39178189
复制相似问题