当前上下文中不存在名称`instance'

时间:2013-11-29 18:55:16

标签: c# xml parsing xml-parsing unity3d

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解析器用于统一..我收到这个错误,我不知道如何解决它...任何建议都会有所帮助:/

1 个答案:

答案 0 :(得分:1)

永远不会声明instance方法中的变量Start,这正是错误告诉你的。