mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkBehaviourTests: SyncVarGameObjectEqualUnspawnedGO
This commit is contained in:
parent
5506503da4
commit
b400f4a04a
@ -764,6 +764,24 @@ public void SyncVarGameObjectEqualValidGOWithSameNetId()
|
||||
// clean up
|
||||
GameObject.DestroyImmediate(go);
|
||||
}
|
||||
|
||||
// NOTE: SyncVarGameObjectEqual should be static later
|
||||
[Test]
|
||||
public void SyncVarGameObjectEqualUnspawnedGO()
|
||||
{
|
||||
// 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();
|
||||
go.AddComponent<NetworkIdentity>();
|
||||
LogAssert.Expect(LogType.Warning, "SetSyncVarGameObject GameObject " + go + " has a zero netId. Maybe it is not spawned yet?");
|
||||
bool result = emptyBehaviour.SyncVarGameObjectEqual(go, identity.netId);
|
||||
Assert.That(result, Is.False);
|
||||
|
||||
// clean up
|
||||
GameObject.DestroyImmediate(go);
|
||||
}
|
||||
}
|
||||
|
||||
// we need to inherit from networkbehaviour to test protected functions
|
||||
|
Loading…
Reference in New Issue
Block a user