private void Awake() { DontDestroyOnLoad(this); if (speechboxInstance == null) { speechboxInstance = this; } else { Object.Destroy(gameObject); } }
// Start is called before the first frame update void Start() { player = GameObject.Find("BonePlayer"); Speech = GameObject.Find("SpeechboxManager").GetComponent <SpeechboxManager>(); TextAsset txtAsset = Resources.Load("NPCData/" + filename) as TextAsset; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(txtAsset.text); name = xmlDoc.DocumentElement.Attributes[0].Value; HandleMenu(xmlDoc.DocumentElement.FirstChild); }