// Cross-initialize. void Start() { // If this hasn't run yet. if (instance == null) { instance = this; // Load the main (required) scene if it is not loaded. if (!GameStateLoader.IsLoaded("main")) { GameStateLoader.LoadSceneAsync("main"); } // Else if it is loaded and it's the only scene loaded. else if (SceneManager.sceneCount == 1) { // Load the title scene. GameStateLoader.LoadSceneAsync("title"); } } else { // Destroy this game object. Destroy(gameObject); } }
public void OnClickPlay() { // Unload the title scene. GameStateLoader.UnloadSceneAsync("title"); // Load the game scene. GameStateLoader.LoadSceneAsync("game"); }
public void OnClickMenu() { // Resume. Resume(); // Quit to the main menu. GameStateLoader.UnloadSceneAsync("pause-menu"); GameStateLoader.UnloadSceneAsync("game"); GameStateLoader.LoadSceneAsync("title"); }
public void OnClickMenu() { // Open the menu and pause the game. GameStateLoader.LoadSceneAsync("pause-menu"); }