Skip to content

Commit

Permalink
feat: optional dontdestroyonload for networkscenemanager (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
uweeby committed Feb 17, 2021
1 parent 8001cc5 commit 67e41bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Assets/Mirage/Runtime/NetworkSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class NetworkSceneManager : MonoBehaviour, INetworkSceneManager
[FormerlySerializedAs("server")]
public NetworkServer Server;

/// <summary>
/// Sets the NetworksSceneManagers GameObject to DontDestroyOnLoad. Default = true.
/// </summary>
public bool DontDestroy = true;

[Header("Events")]
/// <summary>
/// Event fires when the Client starts changing scene.
Expand Down Expand Up @@ -65,7 +70,8 @@ public class NetworkSceneManager : MonoBehaviour, INetworkSceneManager

public void Start()
{
DontDestroyOnLoad(gameObject);
if(DontDestroy)
DontDestroyOnLoad(gameObject);

if (Client != null)
{
Expand Down Expand Up @@ -355,4 +361,4 @@ internal void FinishLoadScene(string scenePath, SceneOperation sceneOperation)
}
}
}
}
}

0 comments on commit 67e41bd

Please sign in to comment.