tests: updating HostSetup.cs

adding methods to spawn a pair of objects for server/client tests
This commit is contained in:
James Frowen 2021-01-25 22:27:43 +00:00 committed by GitHub
parent 3fcc7415b4
commit 2396da8202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,16 @@ public class HostSetup
protected virtual void afterStartHost() { } protected virtual void afterStartHost() { }
protected virtual void beforeStopHost() { } protected virtual void beforeStopHost() { }
protected static void FakeSpawnServerClientIdentity(NetworkIdentity serverNI, NetworkIdentity clientNI)
{
serverNI.OnStartServer();
serverNI.RebuildObservers(true);
clientNI.netId = serverNI.netId;
NetworkIdentity.spawned[serverNI.netId] = clientNI;
clientNI.OnStartClient();
}
[UnitySetUp] [UnitySetUp]
public IEnumerator SetupHost() public IEnumerator SetupHost()
{ {