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
fix: DestroyWithScene causes errors on non-authority side (#3500)
### Description
This PR fixes the issue where enabling the
`NetworkObject.DestroyWithScene` would cause errors on non-authority
instances when loading a new scene (in single mode) or unloading the
scene that the `NetworkObject` instance currently resides and using the
distributed authority network topology.
Fix: #3144
[MTTB-1384](https://jira.unity3d.com/browse/MTTB-1384)
## Changelog
- Fixed: Distributed authority related issue where enabling the
`NetworkObject.DestroyWithScene` would cause errors when a destroying
non-authority instances due to loading (single mode) or unloading scene
events.
## Testing and Documentation
- Includes new integration test: `NetworkObjectDestroyWithSceneTests`.
- 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 a v2.x distributed authority only issue.
<!-- 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
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
14
14
15
15
### Fixed
16
16
17
+
- Fixed distributed authority related issue where enabling the `NetworkObject.DestroyWithScene` would cause errors when a destroying non-authority instances due to loading (single mode) or unloading scene events. (#3500)
AssertOnTimeout($"Not all expected logs were received when destroying a {nameof(NetworkObject)} on the client side during an active session!");
148
167
}
149
-
if(m_DistributedAuthority)
150
-
{
151
-
Assert.IsFalse(m_ClientNetworkManagers[1].SpawnManager.NetworkObjectsToSynchronizeSceneChanges.ContainsKey(m_ClientNetworkObjectId),$"Player object {m_ClientNetworkObjectId} still exists within {nameof(NetworkSpawnManager.NetworkObjectsToSynchronizeSceneChanges)}!");
152
-
}
153
168
else
154
169
{
155
-
Assert.IsFalse(m_ClientNetworkManagers[0].SpawnManager.NetworkObjectsToSynchronizeSceneChanges.ContainsKey(m_ClientNetworkObjectId),$"Player object {m_ClientNetworkObjectId} still exists within {nameof(NetworkSpawnManager.NetworkObjectsToSynchronizeSceneChanges)}!");
AssertOnTimeout($"Timed out waiting for player object {m_ClientNetworkObjectId} to no longer exist within {nameof(NetworkSpawnManager.NetworkObjectsToSynchronizeSceneChanges)}!");
0 commit comments