mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
(Paul Pacheco) Properly reset scene gameobjects when we receive OnObjectSpawnScene
This commit is contained in:
parent
c0d093b1fc
commit
be4b6a8adc
@ -535,6 +535,7 @@ static void OnObjectSpawn(NetworkMessage netMsg)
|
||||
if (s_NetworkScene.GetNetworkIdentity(s_ObjectSpawnMessage.netId, out localNetworkIdentity))
|
||||
{
|
||||
// this object already exists (was in the scene), just apply the update to existing object
|
||||
localNetworkIdentity.Reset();
|
||||
ApplySpawnPayload(localNetworkIdentity, s_ObjectSpawnMessage.position, s_ObjectSpawnMessage.payload, s_ObjectSpawnMessage.netId, null);
|
||||
return;
|
||||
}
|
||||
@ -600,6 +601,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg)
|
||||
if (s_NetworkScene.GetNetworkIdentity(s_ObjectSpawnSceneMessage.netId, out localNetworkIdentity))
|
||||
{
|
||||
// this object already exists (was in the scene)
|
||||
localNetworkIdentity.Reset();
|
||||
ApplySpawnPayload(localNetworkIdentity, s_ObjectSpawnSceneMessage.position, s_ObjectSpawnSceneMessage.payload, s_ObjectSpawnSceneMessage.netId, localNetworkIdentity.gameObject);
|
||||
return;
|
||||
}
|
||||
@ -618,6 +620,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg)
|
||||
}
|
||||
|
||||
if (LogFilter.logDebug) { Debug.Log("Client spawn for [netId:" + s_ObjectSpawnSceneMessage.netId + "] [sceneId:" + s_ObjectSpawnSceneMessage.sceneId + "] obj:" + spawnedId.gameObject.name); }
|
||||
spawnedId.Reset();
|
||||
ApplySpawnPayload(spawnedId, s_ObjectSpawnSceneMessage.position, s_ObjectSpawnSceneMessage.payload, s_ObjectSpawnSceneMessage.netId, spawnedId.gameObject);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user