You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Rework the DestroyObject path on the non-authority client (#3291)
* feat: Rework the DestroyObject path on the non-authority client
* Changelog.md
* update
Adding warning if the NetworkObject does not exist since we should not be receiving a message to destroy a NetworkObject if it is either already destroyed =or= the local client is destroying objects when it should not be.
* update
Changing Debug to NetworkLog
---------
Co-authored-by: NoelStephensUnity <[email protected]>
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
12
12
13
13
### Fixed
14
14
15
+
- Fixed DestroyObject flow on non-authority game clients. (#3291)
15
16
- Fixed exception being thrown when a `GameObject` with an associated `NetworkTransform` is disabled. (#3243)
16
17
- Fixed issue where the scene migration synchronization table was not cleaned up if the `GameObject` of a `NetworkObject` is destroyed before it should have been. (#3230)
17
18
- Fixed issue where the scene migration synchronization table was not cleaned up upon `NetworkManager` shutting down. (#3230)
NetworkLog.LogWarning($"[{nameof(DestroyObjectMessage)}] Received destroy object message for NetworkObjectId ({NetworkObjectId}) on Client-{networkManager.LocalClientId}, but that {nameof(NetworkObject)} does not exist!");
139
120
}
121
+
return;
140
122
}
141
123
142
-
// If we are deferring the despawn, then add it to the deferred despawn queue
143
124
if(networkManager.DistributedAuthorityMode)
144
125
{
145
-
if(DeferredDespawnTick>0)
126
+
// If we are deferring the despawn, then add it to the deferred despawn queue
127
+
// If DAHost has reached this point, it is not valid to add to the queue
128
+
if(DeferredDespawnTick>0&&!networkManager.DAHost)
146
129
{
147
-
// Clients always add it to the queue while DAHost will only add it to the queue if it is not a targeted destroy or it is and the target is the
NetworkLog.LogError($"OnDespawnNonAuthorityObject called on object {networkObject.NetworkObjectId} when is current client {NetworkManager.LocalClientId} has authority on this object.");
1522
+
}
1523
+
1524
+
// On the non-authority, never destroy the game object when InScenePlaced, otherwise always destroy on non-authority side
0 commit comments