We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea30795 commit 3e1aef3Copy full SHA for 3e1aef3
com.unity.multiplayer.mlapi/Runtime/Core/NetworkManager.cs
@@ -719,14 +719,6 @@ private void Awake()
719
720
private void OnEnable()
721
{
722
- if (Singleton != null && Singleton != this)
723
- {
724
- Destroy(gameObject);
725
- return;
726
- }
727
-
728
- SetSingleton();
729
730
if (DontDestroy)
731
732
DontDestroyOnLoad(gameObject);
@@ -736,13 +728,19 @@ private void OnEnable()
736
737
Application.runInBackground = true;
738
}
+
+ if (Singleton == null)
733
+ {
734
+ SetSingleton();
735
+ }
739
740
741
private void OnDestroy()
742
743
- if (Singleton != null && Singleton == this)
+ Shutdown();
+ if (Singleton == this)
744
745
- Shutdown();
746
Singleton = null;
747
748
0 commit comments