From d5edbeea4ebab3f73d626eab66541c10b35ef865 Mon Sep 17 00:00:00 2001 From: Onur Yavuz Meral Date: Thu, 19 May 2016 12:19:53 +0300 Subject: [PATCH 1/2] Update GameManager.cs Added the new SceneManager --- .../Assets/NearbyDroids/Scripts/GameManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/GameManager.cs b/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/GameManager.cs index 68ab6e4ca..019336d10 100644 --- a/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/GameManager.cs +++ b/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/GameManager.cs @@ -24,7 +24,7 @@ namespace NearbyDroids using GooglePlayGames.BasicApi.Nearby; using UnityEngine; using UnityEngine.UI; - + using UnityEngine.SceneManagement; /// /// Game manager manages the game play and players. /// Heavily inspired by http://unity3d.com/learn/tutorials/projects/2d-roguelike @@ -405,7 +405,7 @@ public void StartPlaying(GameType type) } // 1 is the game, 0 is the main menu - Application.LoadLevel(1); + SceneManager.LoadScene(1); } /// @@ -424,7 +424,7 @@ public void StopPlaying() } // 0 is the main menu scene. - Application.LoadLevel(0); + SceneManager.LoadScene(0); } /// @@ -437,7 +437,7 @@ public void StartNextLevel() if (gameType == GameType.MultiplayerLocal || gameType == GameType.SinglePlayer) { - Application.LoadLevel(Application.loadedLevel); + SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } } @@ -642,7 +642,7 @@ public void NotifyChanges() internal void Update() { // if we are on the main menu, don't update. - if (Application.loadedLevel == 0) + if (SceneManager.GetActiveScene().buildIndex == 0) { return; } @@ -1006,4 +1006,4 @@ internal List Players } } } -} \ No newline at end of file +} From 0fee52fbfc0f936f301dbd4fc9181afea2f67734 Mon Sep 17 00:00:00 2001 From: Onur Yavuz Meral Date: Thu, 19 May 2016 12:23:02 +0300 Subject: [PATCH 2/2] Update RemoteGameManager.cs --- .../Source/Assets/NearbyDroids/Scripts/RemoteGameManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/RemoteGameManager.cs b/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/RemoteGameManager.cs index ab0dab0cc..cd661a4af 100644 --- a/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/RemoteGameManager.cs +++ b/samples/NearbyDroids/Source/Assets/NearbyDroids/Scripts/RemoteGameManager.cs @@ -18,7 +18,7 @@ namespace NearbyDroids { using System.Collections.Generic; using UnityEngine; - + using UnityEngine.SceneManagement; /// /// Remote game manager. used to manage the game state for a player /// that is not hosting the room. @@ -73,7 +73,7 @@ internal void InitGame(GameManager.GameStateData data) data.Level); owner.GameState = data; owner.LevelManager.DestroyBoard(); - Application.LoadLevel(Application.loadedLevel); + SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); return; }