void ApplySpawnPayload(NetworkIdentity identity, SpawnMessage msg) { if (msg.assetId != Guid.Empty) { identity.AssetId = msg.assetId; } if (!identity.gameObject.activeSelf) { identity.gameObject.SetActive(true); } identity.SetClientValues(this, msg); if (msg.isLocalPlayer) { InternalAddPlayer(identity); } // deserialize components if any payload // (Count is 0 if there were no components) if (msg.payload.Count > 0) { using (PooledNetworkReader payloadReader = NetworkReaderPool.GetReader(msg.payload)) { identity.OnDeserializeAllSafely(payloadReader, true); } } // objects spawned as part of initial state are started on a second pass identity.NotifyAuthority(); identity.StartClient(); CheckForLocalPlayer(identity); }
private void ApplySpawnPayload(NetworkIdentity identity, SpawnMessage msg) { if (msg.prefabHash.HasValue) { identity.PrefabHash = msg.prefabHash.Value; } if (!identity.gameObject.activeSelf) { identity.gameObject.SetActive(true); } identity.SetClientValues(this, msg); if (msg.isLocalPlayer) { InternalAddCharacter(identity); } // deserialize components if any payload // (Count is 0 if there were no components) if (msg.payload.Count > 0) { using (var payloadReader = NetworkReaderPool.GetReader(msg.payload, Client.World)) { identity.OnDeserializeAll(payloadReader, true); } } // objects spawned as part of initial state are started on a second pass identity.NotifyAuthority(); identity.StartClient(); CheckForLocalPlayer(identity); }