mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Tests simplified
This commit is contained in:
parent
2328747b33
commit
8b42915429
@ -91,8 +91,11 @@ public void Shutdown_DisablesAllSpawnedPrefabs()
|
|||||||
// setup
|
// setup
|
||||||
NetworkServer.Listen(1);
|
NetworkServer.Listen(1);
|
||||||
|
|
||||||
NetworkIdentity identity1 = SpawnSceneObject();
|
// spawn two scene objects
|
||||||
NetworkIdentity identity2 = SpawnSceneObject();
|
CreateNetworkedAndSpawn(out _, out NetworkIdentity identity1);
|
||||||
|
CreateNetworkedAndSpawn(out _, out NetworkIdentity identity2);
|
||||||
|
identity1.sceneId = (ulong)identity1.GetHashCode();
|
||||||
|
identity2.sceneId = (ulong)identity2.GetHashCode();
|
||||||
|
|
||||||
// test
|
// test
|
||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
@ -106,15 +109,5 @@ public void Shutdown_DisablesAllSpawnedPrefabs()
|
|||||||
|
|
||||||
Assert.That(NetworkIdentity.spawned, Is.Empty);
|
Assert.That(NetworkIdentity.spawned, Is.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkIdentity SpawnSceneObject()
|
|
||||||
{
|
|
||||||
CreateNetworked(out GameObject obj, out NetworkIdentity identity);
|
|
||||||
if (identity.sceneId == 0) { identity.sceneId = (ulong)obj.GetHashCode(); }
|
|
||||||
NetworkServer.Spawn(obj);
|
|
||||||
|
|
||||||
Assert.IsTrue(NetworkIdentity.spawned.ContainsValue(identity));
|
|
||||||
return identity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user