diff --git a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs index 7bdb2f722..e720b3bf0 100644 --- a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs @@ -316,7 +316,10 @@ public void SendCommandInternal() isAuthenticated = true }; connection.connectionToServer.connectionToClient = connection; + + // host needs connection to both directions identity.connectionToClient = connection; + identity.connectionToServer = connection.connectionToServer; // calling command before client is connected shouldn't work // error log is expected diff --git a/Assets/Mirror/Tests/Editor/RemoteTestBase.cs b/Assets/Mirror/Tests/Editor/RemoteTestBase.cs index 933bde29a..23545cbd0 100644 --- a/Assets/Mirror/Tests/Editor/RemoteTestBase.cs +++ b/Assets/Mirror/Tests/Editor/RemoteTestBase.cs @@ -58,7 +58,10 @@ protected T CreateHostObject(bool spawnWithAuthority) where T : NetworkBehavi GameObject gameObject = new GameObject(); spawned.Add(gameObject); - gameObject.AddComponent(); + NetworkIdentity netIdentity = gameObject.AddComponent(); + + // host mode object needs a connection to server for commands to work + netIdentity.connectionToServer = NetworkClient.readyConnection; T behaviour = gameObject.AddComponent();