NetworkBehaviourTests: SyncVarGameObjectEqualUnspawnedGO

This commit is contained in:
vis2k 2020-03-07 14:45:23 +01:00
parent 5506503da4
commit b400f4a04a

View File

@ -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