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: owner changing ownership causing identical previous and current ids when using a distributed authority network topology (#3347)
This fixes an issue with the synchronization of NetworkVariables when
changing ownership where it was possible to have the previous owner be
equal to the current owner when using a distributed authority network
topology and the owner handled changing the ownership.
This includes an additional check for ditry states of any collections
base NetworkVariables.
<!-- Add short version of the JIRA ticket to the PR title (e.g. "feat:
new shiny feature [MTT-123]") -->
fix: #3343close: #3343
## Changelog
- Fixed issue where an owner that changes ownership, when using a
distributed authority network topology, could yield identical previous
and current owner identifiers. This could also cause `NetworkTransform`
to fail to change ownership which would leave the previous owner still
subscribed to network tick events.
## Testing and Documentation
- Includes integration test
`NetworkObjectOwnershipTests.TestAuthorityChangingOwnership`.
- 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.
-->
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
20
20
21
21
- Fixed issue when using a distributed authority network topology and many clients attempt to connect simultaneously the session owner could max-out the maximum in-flight reliable messages allowed, start dropping packets, and some of the connecting clients would fail to fully synchronize. (#3350)
22
22
- Fixed issue when using a distributed authority network topology and scene management was disabled clients would not be able to spawn any new network prefab instances until synchronization was complete. (#3350)
23
+
- Fixed issue where an owner that changes ownership, when using a distributed authority network topology, could yield identical previous and current owner identifiers. This could also cause `NetworkTransform` to fail to change ownership which would leave the previous owner still subscribed to network tick events. (#3347)
23
24
- Fixed issue where the `MaximumInterpolationTime` could not be modified from within the inspector view or runtime. (#3337)
24
25
- Fixed `ChangeOwnership` changing ownership to clients that are not observers. This also happened with automated object distribution. (#3323)
25
26
- Fixed issue where `AnticipatedNetworkVariable` previous value returned by `AnticipatedNetworkVariable.OnAuthoritativeValueChanged` is updated correctly on the non-authoritative side. (#3306)
Debug.LogWarning($"[{nameof(NetworkSpawnManager)}][{nameof(ChangeOwnership)}] Attempting to change ownership to Client-{clientId} when the owner is already {networkObject.OwnerClientId}! (Ignoring)");
440
+
}
441
+
return;
442
+
}
443
+
435
444
// For client-server:
436
445
// If ownership changes faster than the latency between the client-server and there are NetworkVariables being updated during ownership changes,
437
446
// then notify the user they could potentially lose state updates if developer logging is enabled.
Assert.True(previous!=current,$"[{nameof(OnOwnershipChanged)}][Invalid Parameters] Invoked and the previous ({previous}) equals the current ({current})!");
0 commit comments