【发布时间】:2013-11-29 18:55:16
【问题描述】:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
public class NetManager : MonoBehaviour
{
// URL can be also locale : "file://C:\file.xml"
private static string URL = "http://www.domain.com/file.xml";
private XMLManager.Player player = null;
void Start() {
StartCoroutine (instance.RetrieveNextPlayerCoroutine (callback));
}
// ----------- Retrieve Player -------------- //
public delegate void RetrieveNextPlayerCallback (XMLManager.Player result);
private IEnumerator RetrieveNextPlayerCoroutine (RetrieveNextPlayerCallback callback)
{
WWW www = new WWW (URL);
yield return www;
if (www.error == null) {
player = XMLManager.ParsePlayerXML (www.text);
} else {
Debug.Log (www.error);
}
}
}
我已经获得了一个用于统一的 xml 解析器。我收到了这个错误,但我不知道如何解决它。任何建议都会有所帮助:/
【问题讨论】:
-
嗯,是的 - 您正在调用
instance.RetrieveNextPlayerCoroutine- 但您没有名为instance的变量。 -
发布代码时,请将其发布在本网站上,而不是链接到包含代码的外部网站。我编辑了您的帖子以将代码移至此处。
-
邮件的哪一部分你不明白?
-
@JohnKoerner - 道歉
-
@SLaks - 我刚得到这个,我被告知只需插入并使用它,我没有写它,而且我不熟悉 C#,所以我不真的不知道这里发生了什么
标签: c# xml parsing xml-parsing unity3d