From 3d350f3320272031d2479d7f54c051acaa298a28 Mon Sep 17 00:00:00 2001 From: vis2k Date: Tue, 10 Aug 2021 18:45:07 +0800 Subject: [PATCH] GetSyncVarNetworkIdentityOnClient Test: use CreateNetworkedAndSpawn instead of manually adding to spawned --- .../Mirror/Tests/Editor/NetworkBehaviourTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs index 5a594d370..92973addf 100644 --- a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs @@ -828,19 +828,19 @@ public void GetSyncVarNetworkIdentityOnServerNull() [Test] public void GetSyncVarNetworkIdentityOnClient() { + // start server & connect client because we need spawn functions + NetworkServer.Listen(1); + ConnectClientBlockingAuthenticatedAndReady(out _); + CreateNetworked(out GameObject _, out NetworkIdentity identity, out NetworkBehaviourGetSyncVarNetworkIdentityComponent comp); // are we on client and not on server? identity.isClient = true; Assert.That(identity.isServer, Is.False); - // create a syncable GameObject - CreateNetworked(out GameObject _, out NetworkIdentity ni); - ni.netId = 43; - - // register in spawned dict because clients should look it up via - // netId - NetworkIdentity.spawned[ni.netId] = ni; + // create a spawned, syncable GameObject + // (client tries to look up via netid, so needs to be spawned) + CreateNetworkedAndSpawn(out GameObject _, out NetworkIdentity ni); // assign ONLY netId in the component. assume that GameObject was // assigned earlier but client walked so far out of range that it