From 78d159d7da0c71838aec67f9efee9641570b6105 Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Thu, 28 Jun 2018 19:05:20 -0500 Subject: [PATCH] Properly reset scene gameobjects when we receive OnObjectSpawnScene --- Unity-Technologies-networking/Runtime/ClientScene.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Unity-Technologies-networking/Runtime/ClientScene.cs b/Unity-Technologies-networking/Runtime/ClientScene.cs index 25133d1e3..2f86330f6 100644 --- a/Unity-Technologies-networking/Runtime/ClientScene.cs +++ b/Unity-Technologies-networking/Runtime/ClientScene.cs @@ -415,6 +415,7 @@ static void OnObjectSpawn(NetworkMessage netMsg) if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity)) { // this object already exists (was in the scene), just apply the update to existing object + localNetworkIdentity.Reset(); ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, null); return; } @@ -481,6 +482,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg) if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity)) { // this object already exists (was in the scene) + localNetworkIdentity.Reset(); ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, localNetworkIdentity.gameObject); return; } @@ -499,6 +501,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg) } if (LogFilter.logDebug) { Debug.Log("Client spawn for [netId:" + msg.netId + "] [sceneId:" + msg.sceneId + "] obj:" + spawnedId.gameObject.name); } + spawnedId.Reset(); ApplySpawnPayload(spawnedId, msg.position, msg.payload, msg.netId, spawnedId.gameObject); }