This commit is contained in:
vis2k 2021-03-07 18:10:51 +08:00
parent 82b8f650fb
commit ead0d351c9

View File

@ -855,15 +855,14 @@ static void DestroyObject(uint netId)
internal static void OnHostClientObjectDestroy(ObjectDestroyMessage msg) internal static void OnHostClientObjectDestroy(ObjectDestroyMessage msg)
{ {
// Debug.Log("ClientScene.OnLocalObjectObjDestroy netId:" + msg.netId); // Debug.Log("ClientScene.OnLocalObjectObjDestroy netId:" + msg.netId);
NetworkIdentity.spawned.Remove(msg.netId); NetworkIdentity.spawned.Remove(msg.netId);
} }
internal static void OnHostClientObjectHide(ObjectHideMessage msg) internal static void OnHostClientObjectHide(ObjectHideMessage msg)
{ {
// Debug.Log("ClientScene::OnLocalObjectObjHide netId:" + msg.netId); // Debug.Log("ClientScene::OnLocalObjectObjHide netId:" + msg.netId);
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) &&
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null) localObject != null)
{ {
localObject.OnSetHostVisibility(false); localObject.OnSetHostVisibility(false);
} }
@ -871,7 +870,8 @@ internal static void OnHostClientObjectHide(ObjectHideMessage msg)
internal static void OnHostClientSpawn(SpawnMessage msg) internal static void OnHostClientSpawn(SpawnMessage msg)
{ {
if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) && localObject != null) if (NetworkIdentity.spawned.TryGetValue(msg.netId, out NetworkIdentity localObject) &&
localObject != null)
{ {
if (msg.isLocalPlayer) if (msg.isLocalPlayer)
InternalAddPlayer(localObject); InternalAddPlayer(localObject);