public void OnUpdate() { // If animation ready to load level if (loadingScreen.finAppearAnim && shouldLoadScene) { shouldLoadScene = false; SceneManager.LoadScene(GameStateManager.Instance.sceneIndex); } if (loadingSceneFinished) { loadingSceneFinished = false; loadingScreen.EndLoadingScreen(); } // When animation finished if (loadingScreen.finDisappearAnim) { // Unbind sceneListener SceneManager.sceneLoaded -= OnSceneLoaded; owner.SetState(new LevelRunning(owner)); } }