Exemplo n.º 1
0
        public IEnumerator LocalPlayerIsSetToNullAfterNetworkDestroy()
        {
            const uint netId = 1000;

            GameObject go = new GameObject();

            NetworkIdentity identity = go.AddComponent <NetworkIdentity>();

            SpawnMessage msg = new SpawnMessage
            {
                netId         = netId,
                isLocalPlayer = true,
                isOwner       = true,
            };


            NetworkIdentity.spawned[msg.netId] = identity;
            ClientScene.OnHostClientSpawn(msg);

            NetworkServer.Destroy(identity.gameObject);

            // wait a frame for destroy to happen
            yield return(null);

            // use "is null" here to avoid unity == check
            Assert.IsTrue(ClientScene.localPlayer is null, "local player should be set to c# null");
        }