/** * Initializes the WordGameSystem or fetches it if it exists already */ private void initSystem() { if (!GameObject.Find("wordGameSystem")) { system = GameObject.Instantiate(systemPrefab).GetComponent <WordGameSystemScript>(); //system.init(); } else { system = GameObject.Find("wordGameSystem").GetComponent <WordGameSystemScript>(); } }
WordGameSystemScript system; //reference to the WordGameSystemScript // Use this for initialization /** * Fetches or creates the WordGameSystem object, updates the level select buttons and cats and then starts the music loop. */ void Start() { if (!GameObject.Find("wordGameSystem")) { system = GameObject.Instantiate(systemPrefab).GetComponent <WordGameSystemScript>(); //system.init(); Debug.Log("System initialized"); } else { system = GameObject.Find("wordGameSystem").GetComponent <WordGameSystemScript>(); } checkButtons(); MusicPlayer.PlayMusic(MusicTrack.BubbleWarehouseCutscene); }