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