From 2396da8202d57eeac15d6bfc497937e3d7118f7e Mon Sep 17 00:00:00 2001 From: James Frowen Date: Mon, 25 Jan 2021 22:27:43 +0000 Subject: [PATCH] tests: updating HostSetup.cs adding methods to spawn a pair of objects for server/client tests --- Assets/Mirror/Tests/Runtime/HostSetup.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/Mirror/Tests/Runtime/HostSetup.cs b/Assets/Mirror/Tests/Runtime/HostSetup.cs index 1e1f40d04..65f368aad 100644 --- a/Assets/Mirror/Tests/Runtime/HostSetup.cs +++ b/Assets/Mirror/Tests/Runtime/HostSetup.cs @@ -18,6 +18,16 @@ public class HostSetup protected virtual void afterStartHost() { } 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] public IEnumerator SetupHost() {