File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
com.unity.netcode.gameobjects/Runtime Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1177,7 +1177,7 @@ internal void OnClientDisconnectFromServer(ulong clientId)
11771177 {
11781178 // If destroying with owner, then always despawn and destroy (or defer destroying to prefab handler)
11791179 // Handle an object with no observers other than the current disconnecting client as destroying with owner
1180- if ( ! ownedObject . DontDestroyWithOwner || ownedObject . Observers . Count == 0 || ( ownedObject . Observers . Count == 1 && ownedObject . Observers . Contains ( clientId ) ) )
1180+ if ( ! ownedObject . DontDestroyWithOwner && ( ownedObject . Observers . Count == 0 || ( ownedObject . Observers . Count == 1 && ownedObject . Observers . Contains ( clientId ) ) ) )
11811181 {
11821182 if ( NetworkManager . PrefabHandler . ContainsHandler ( ownedObject . GlobalObjectIdHash ) )
11831183 {
@@ -1243,7 +1243,7 @@ internal void OnClientDisconnectFromServer(ulong clientId)
12431243 }
12441244
12451245 // Skip destroy with owner objects as they will be processed by the outer loop
1246- if ( ! childObject . DontDestroyWithOwner || childObject . Observers . Count == 0 || ( childObject . Observers . Count == 1 && childObject . Observers . Contains ( clientId ) ) )
1246+ if ( ! childObject . DontDestroyWithOwner && ( childObject . Observers . Count == 0 || ( childObject . Observers . Count == 1 && childObject . Observers . Contains ( clientId ) ) ) )
12471247 {
12481248 continue ;
12491249 }
Original file line number Diff line number Diff line change @@ -1449,7 +1449,7 @@ internal void DespawnAndDestroyNetworkObjects()
14491449 {
14501450 // If it is an in-scene placed NetworkObject then just despawn and let it be destroyed when the scene
14511451 // is unloaded. Otherwise, despawn and destroy it.
1452- var shouldDestroy = ! ( networkObjects [ i ] . IsSceneObject == null || ( networkObjects [ i ] . IsSceneObject != null && networkObjects [ i ] . IsSceneObject . Value ) ) ;
1452+ var shouldDestroy = ! ( networkObjects [ i ] . DontDestroyWithOwner || networkObjects [ i ] . IsSceneObject == null || ( networkObjects [ i ] . IsSceneObject != null && networkObjects [ i ] . IsSceneObject . Value ) ) ;
14531453
14541454 // If we are going to destroy this NetworkObject, check for any in-scene placed children that need to be removed
14551455 if ( shouldDestroy )
You can’t perform that action at this time.
0 commit comments