Skip to content

Commit 4c198f7

Browse files
fix
This resolves the issue with the new edge case where a scene could be unloaded but a spawned object referencing the scene handle could still be spawned (pending being de-spawned within a few frames).
1 parent c45ec94 commit 4c198f7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,15 +3420,14 @@ internal void SceneChangedUpdate(Scene scene, bool notify = false)
34203420
{
34213421
// Since the authority is the source of truth for the NetworkSceneHandle,
34223422
// the NetworkSceneHandle is the same as the SceneOriginHandle.
3423-
if (NetworkManager.DistributedAuthorityMode)
3423+
if (NetworkManager.DistributedAuthorityMode && NetworkManager.SceneManager.ClientSceneHandleToServerSceneHandle.ContainsKey(SceneOriginHandle))
34243424
{
34253425
NetworkSceneHandle = NetworkManager.SceneManager.ClientSceneHandleToServerSceneHandle[SceneOriginHandle];
34263426
}
34273427
else
34283428
{
34293429
NetworkSceneHandle = SceneOriginHandle;
34303430
}
3431-
34323431
}
34333432
else // Otherwise, the client did not find the client to server scene handle
34343433
if (NetworkManager.LogLevel == LogLevel.Developer)

0 commit comments

Comments
 (0)