mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkBehaviourTests: SyncVarNetworkIdentityEqualUnspawnedIdentity
This commit is contained in:
parent
a9f83bb8bc
commit
e4e540c602
@ -859,6 +859,24 @@ public void SyncVarNetworkIdentityEqualValidIdentityWithSameNetId()
|
|||||||
// clean up
|
// clean up
|
||||||
GameObject.DestroyImmediate(go);
|
GameObject.DestroyImmediate(go);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: SyncVarNetworkIdentityEqual should be static later
|
||||||
|
[Test]
|
||||||
|
public void SyncVarNetworkIdentityEqualUnspawnedIdentity()
|
||||||
|
{
|
||||||
|
// our identity should have a netid for comparing
|
||||||
|
identity.netId = 42;
|
||||||
|
|
||||||
|
// gameobject with valid networkidentity and 0 netid that is unspawned
|
||||||
|
GameObject go = new GameObject();
|
||||||
|
NetworkIdentity ni = go.AddComponent<NetworkIdentity>();
|
||||||
|
LogAssert.Expect(LogType.Warning, "SetSyncVarNetworkIdentity NetworkIdentity " + ni + " has a zero netId. Maybe it is not spawned yet?");
|
||||||
|
bool result = emptyBehaviour.SyncVarNetworkIdentityEqual(ni, identity.netId);
|
||||||
|
Assert.That(result, Is.False);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
GameObject.DestroyImmediate(go);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to inherit from networkbehaviour to test protected functions
|
// we need to inherit from networkbehaviour to test protected functions
|
||||||
|
Loading…
Reference in New Issue
Block a user