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
This resolves the
[Forum-1658887](https://discussions.unity.com/t/network-objects-dont-despawn-on-disconnect-even-with-dont-destroy-with-owner-unchecked/1658887)
discovered client-server specific issue in the v2.4.2 release where
spawned objects with the default `NetworkObject.DontDestroyWithOwner`
setting (disabled/false) would not be despawned and destroyed when the
owning client disconnected.
## Changelog
- Fixed: Issue where spawned objects with
`NetworkObject.DontDestroyWithOwner` set to `false` would not be
destroyed when using a client-server network topology.
## Testing and Documentation
- Includes updates to the `NetworkObjectDontDestroyWithOwnerTests`
integration test.
- No documentation changes or additions were necessary.
<!-- Uncomment and mark items off with a * if this PR deprecates any
API:
### Deprecated API
- [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter
yyyy-mm-dd)` entry.
- [ ] An [api updater] was added.
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they
should use instead.
-->
## Backport
This is specific to NGO v2.4.2 release.
<!-- If this is a backport:
- Add the following to the PR title: "\[Backport\] ..." .
- Link to the original PR.
If this needs a backport - state this here
If a backport is not needed please provide the reason why.
If the "Backports" section is not present it will lead to a CI test
failure.
-->
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
7
7
Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).
8
8
9
+
## [Unreleased]
10
+
11
+
### Fixed
12
+
13
+
- Fixed issue where spawned objects with `NetworkObject.DontDestroyWithOwner` is set to `false` would not be destroyed when using a client-server network topology. (#3522)
Assert.False(s_GlobalTimeoutHelper.TimedOut,$"Timed out waiting for client to have 33 NetworkObjects spawned! Only {client.SpawnManager.GetClientOwnedObjects(clientId).Count()} were assigned!");
errorLog.AppendLine($"[Client-{networkManager.LocalClientId}][DontDestroyWithOwner][!Despawned!] {nameof(NetworkObject)}-{dontDestroyObjectId} should not despawn upon the owner disconnecting!");
errorLog.AppendLine($"[Client-{networkManager.LocalClientId}][DestroyWithOwner][!Not Despawned!] {nameof(NetworkObject)}-{destroyObjectId} should have despawned upon the owner disconnecting!");
64
141
}
65
142
}
66
143
}
144
+
returnerrorLog.Length==0;
145
+
}
67
146
68
-
// disconnect the client that owns all the clients
Assert.False(s_GlobalTimeoutHelper.TimedOut,"Timed out waiting for client to disconnect!");
161
+
// This should never fail.
162
+
Assert.IsTrue(m_DontDestroyObjectIds.Count==m_DestroyObjectIds.Count,$"Mismatch in spawn count! ({m_DontDestroyObjectIds.Count}) vs ({m_DestroyObjectIds.Count})");
0 commit comments