fix: Use path instead of name in Room Example

This commit is contained in:
Chris Langsenkamp 2020-04-20 11:04:18 -04:00
parent 2a2f76c263
commit 5d4bc47d46

View File

@ -25,7 +25,7 @@ public override void OnRoomStopClient()
{ {
// Demonstrates how to get the Network Manager out of DontDestroyOnLoad when // Demonstrates how to get the Network Manager out of DontDestroyOnLoad when
// going to the offline scene to avoid collision with the one that lives there. // going to the offline scene to avoid collision with the one that lives there.
if (gameObject.scene.name == "DontDestroyOnLoad" && !string.IsNullOrEmpty(offlineScene) && SceneManager.GetActiveScene().name != offlineScene) if (gameObject.scene.name == "DontDestroyOnLoad" && !string.IsNullOrEmpty(offlineScene) && SceneManager.GetActiveScene().path != offlineScene)
SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene()); SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene());
base.OnRoomStopClient(); base.OnRoomStopClient();
@ -35,7 +35,7 @@ public override void OnRoomStopServer()
{ {
// Demonstrates how to get the Network Manager out of DontDestroyOnLoad when // Demonstrates how to get the Network Manager out of DontDestroyOnLoad when
// going to the offline scene to avoid collision with the one that lives there. // going to the offline scene to avoid collision with the one that lives there.
if (gameObject.scene.name == "DontDestroyOnLoad" && !string.IsNullOrEmpty(offlineScene) && SceneManager.GetActiveScene().name != offlineScene) if (gameObject.scene.name == "DontDestroyOnLoad" && !string.IsNullOrEmpty(offlineScene) && SceneManager.GetActiveScene().path != offlineScene)
SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene()); SceneManager.MoveGameObjectToScene(gameObject, SceneManager.GetActiveScene());
base.OnRoomStopServer(); base.OnRoomStopServer();