NetworkBehaviourTests: ComponentIndex simplified

This commit is contained in:
vis2k 2021-05-23 19:12:03 +08:00
parent ec332f8b74
commit edcbaae9a4

View File

@ -270,14 +270,10 @@ public void HasIdentitysConnectionToClient()
[Test] [Test]
public void ComponentIndex() public void ComponentIndex()
{ {
// add one extra component // create a NetworkIdentity with two components
EmptyBehaviour extra = gameObject.AddComponent<EmptyBehaviour>(); CreateNetworked(out GameObject _, out NetworkIdentity _, out EmptyBehaviour first, out EmptyBehaviour second);
Assert.That(first.ComponentIndex, Is.EqualTo(0));
// original one is first networkbehaviour, so index is 0 Assert.That(second.ComponentIndex, Is.EqualTo(1));
Assert.That(emptyBehaviour.ComponentIndex, Is.EqualTo(0));
// extra one is second networkbehaviour, so index is 1
Assert.That(extra.ComponentIndex, Is.EqualTo(1));
} }
[Test] [Test]