mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Properly reset scene gameobjects when we receive OnObjectSpawnScene
This commit is contained in:
parent
ec7185ad49
commit
78d159d7da
@ -415,6 +415,7 @@ static void OnObjectSpawn(NetworkMessage netMsg)
|
|||||||
if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
|
if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
|
||||||
{
|
{
|
||||||
// this object already exists (was in the scene), just apply the update to existing object
|
// 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);
|
ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -481,6 +482,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg)
|
|||||||
if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
|
if (s_NetworkScene.GetNetworkIdentity(msg.netId, out localNetworkIdentity))
|
||||||
{
|
{
|
||||||
// this object already exists (was in the scene)
|
// this object already exists (was in the scene)
|
||||||
|
localNetworkIdentity.Reset();
|
||||||
ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, localNetworkIdentity.gameObject);
|
ApplySpawnPayload(localNetworkIdentity, msg.position, msg.payload, msg.netId, localNetworkIdentity.gameObject);
|
||||||
return;
|
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); }
|
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);
|
ApplySpawnPayload(spawnedId, msg.position, msg.payload, msg.netId, spawnedId.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user