private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1) { if (!enabled || safetyEnabled) { return; } if (arg1.name == "GameCore" && !legacyMode) //Launch calories counter { Console.WriteLine(modLog + "Scene Loaded succesfully"); legCalCounter = null; calCounter = null; calCounter = new GameObject("inGameCalorieCounter").AddComponent <igcv02x>(); Console.WriteLine(modLog + "Calorie counter loaded!"); } else if (arg1.name == "GameCore" && legacyMode) //Launch Legacy Calorie Counter { Console.WriteLine(modLog + "Legacy Calorie Counter being loaded..."); calCounter = null; legCalCounter = null; legCalCounter = new GameObject("legacyCalorieCounter").AddComponent <CalorieCounter>(); } if (arg1.name == "Menu") { if (display != null) { return; } display = null; display = new GameObject("MenuDisplay").AddComponent <MenuDisplay>(); } return; }
public void OnApplicationQuit() { SceneManager.activeSceneChanged -= SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded -= SceneManager_sceneLoaded; calCounter = null; display = null; }
public void OnApplicationQuit() { SceneManager.activeSceneChanged -= SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded -= SceneManager_sceneLoaded; calCounter = null; display = null; mainConfig.Save(); userConfigs.Save(); }