Merged in paulpach/hlapi-community-edition-lag/reset2 (pull request #22)

Properly reset scene gameobjects when we receive OnObjectSpawnScene
This commit is contained in:
Paul Pacheco 2018-06-29 08:44:29 +00:00 committed by vis2k
commit d3f23f7f04

View File

@ -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);
}