NetworkBehaviourTests: SyncVarGameObjectEqualWithoutIdentityComponent

This commit is contained in:
vis2k 2020-03-07 14:33:43 +01:00
parent 949ce8288c
commit 08f426970a

View File

@ -683,6 +683,22 @@ public void SyncVarGameObjectEqualNull()
bool result = emptyBehaviour.SyncVarGameObjectEqual(null, identity.netId);
Assert.That(result, Is.False);
}
// NOTE: SyncVarGameObjectEqual should be static later
[Test]
public void SyncVarGameObjectEqualWithoutIdentityComponent()
{
// our identity should have a netid for comparing
identity.netId = 42;
// gameobject without networkidentity component should return false
GameObject go = new GameObject();
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