public override void OnLevelUnloading() { if (component != null) { GameObject.Destroy(component.gameObject); component = null; } } // Destroys the game object
public override void OnLevelLoaded(LoadMode mode) { if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame) { // init the game time to be used Utils._lastCheckedTime = Singleton <SimulationManager> .instance.m_currentGameTime; GameObject gameObject = new GameObject("BloomingTourism"); component = gameObject.AddComponent <TourismControlComponent>(); Debug.LogWarning(string.Format("population size is {0}, amount of tourists to create this month is {1}", Utils.GetPopulation(), DataStorage.instance.amountOfTourists_Month)); } }