diff --git a/Assets/Mirror/Tests/Common/MirrorTest.cs b/Assets/Mirror/Tests/Common/MirrorTest.cs index b8b9ccd25..cf79f3680 100644 --- a/Assets/Mirror/Tests/Common/MirrorTest.cs +++ b/Assets/Mirror/Tests/Common/MirrorTest.cs @@ -16,14 +16,22 @@ public abstract class MirrorTest public List instantiated; // we usually need the memory transport + GameObject holder; public MemoryTransport transport; public virtual void SetUp() { instantiated = new List(); + // need a holder GO + holder = new GameObject(); + // need a transport to send & receive - Transport.activeTransport = transport = new GameObject().AddComponent(); + Transport.activeTransport = transport = holder.AddComponent(); + + // NetworkServer was static before (= always existed). + // so always create the component again. + NetworkServerComponent.singleton = holder.AddComponent(); } public virtual void TearDown() @@ -41,7 +49,8 @@ public virtual void TearDown() if (go != null) GameObject.DestroyImmediate(go); - GameObject.DestroyImmediate(transport.gameObject); + GameObject.DestroyImmediate(holder); + NetworkServerComponent.singleton = null; Transport.activeTransport = null; } diff --git a/Assets/Mirror/Tests/Editor/InterestManagementTests_Distance.cs b/Assets/Mirror/Tests/Editor/InterestManagementTests_Distance.cs index 9d8cf35a6..fca4740a4 100644 --- a/Assets/Mirror/Tests/Editor/InterestManagementTests_Distance.cs +++ b/Assets/Mirror/Tests/Editor/InterestManagementTests_Distance.cs @@ -24,8 +24,6 @@ public override void SetUp() public override void TearDown() { base.TearDown(); - // clear server aoi again - NetworkServer.aoi = null; } // brute force interest management