public void OnApplicationQuit() { SceneManager.activeSceneChanged -= SceneManagerOnActiveSceneChanged; SceneManager.sceneLoaded -= SceneManager_sceneLoaded; calCount = null; display = null; }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1) { if (!enabled && safetyEnabled) { return; } if (arg1.name == "GameCore") //Launch calories counter { Console.WriteLine("[fitNessMod | LOG] Scene Loaded succesfully"); calCount = null; calCount = new GameObject("CalorieCounter").AddComponent <CalorieCounter>(); Console.WriteLine("[fitNessMod | LOG] calorie counter loaded!"); } if (arg1.name == "Menu" /*|| arg1.name == "HealthWarning"*/) //On menu == display. HealthWarning used for layout setup. Will be removed later. { if (display != null) { return; } display = null; display = new GameObject("MenuDisplay").AddComponent <MenuDisplay>(); Console.WriteLine("[fitNessMod | LOG] Menu calories displayed"); } return; }