private void OnEnable() { this.maxSize = new Vector2(600, 600); XmlDocument doc = new XmlDocument(); string path = "Assets/Examples/GUIGames/BWC/Editor/Game_BWC.xml"; doc.Load(path); guiCanvas = new GUICanvas(); guiCanvas.DeSerialize(doc.DocumentElement); WC = Resources.Load <Texture2D>("bai"); BC = Resources.Load <Texture2D>("hei"); map = new Map(guiCanvas.Find <Area>("map")); wCount = guiCanvas.Find <Label>("top/count/w/count"); bCount = guiCanvas.Find <Label>("top/count/b/count"); jiesuan = guiCanvas.Find <ImageArea>("jiesuan"); GameObject go = new GameObject("BG"); go.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy; BG = go.AddComponent <AudioSource>(); BG.clip = Resources.Load <AudioClip>("BG"); BG.Play(); BG.loop = true; go = new GameObject("sound"); go.hideFlags = HideFlags.DontSave | HideFlags.HideInHierarchy; Sound = go.AddComponent <AudioSource>(); }