mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
GetSyncVarNetworkIdentityOnClient Test: use CreateNetworkedAndSpawn instead of manually adding to spawned
This commit is contained in:
parent
4591bde5e3
commit
3d350f3320
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user