Skip to content

[DA] OnGainedOwnership and OnLostOwnership callbacks are invoked on all clients #3345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevincastejon opened this issue Mar 9, 2025 · 2 comments
Labels
priority:medium This issue has medium priority and may take some time to be resolved stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report type:docs Docs feedback or issue

Comments

@kevincastejon
Copy link

Description

The OnGainedOwnership and OnLostOwnership methods descriptions says that, with the Distributed Authority mode, they are called only on the local client that gained or lost ownership on the object.

But actually these methods are called on each client regardless of them being concerned or not by the ownership gain/lost.

Reproduce Steps

  1. Use DistributedAuthority topology
  2. Change ownership on one client side
  3. See all clients having their callbacks invoked

Actual Outcome

OnGainedOwnership and OnLostOwnership callbacks are invoked on all clients

Expected Outcome

OnGainedOwnership and OnLostOwnership callbacks are invoked only on client that actually gain or lost the ownership.

Screenshots

Image

Environment

  • OS: Windows11
  • Unity Version: 6000.0.41f
  • Netcode Version: 2.2.0

Additional Context

On the attached gif screen record, the ownership of the sphere transferable network object is changed on mouse down.

@kevincastejon kevincastejon added stat:awaiting-triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Mar 9, 2025
@NoelStephensUnity
Copy link
Collaborator

Hi @kevincastejon,

This seems to be an XML API documentation issue as it was decided ownership changes should be invoked on all clients for distributed authority since that could be pertinent information to know (depending upon usage). The idea being that clients have more visibility (similar to a host).

This behavior is intended, but I am going to mark this as a verified bug with our XML API documentation.
Thank you for pointing this out. 👍

@NoelStephensUnity NoelStephensUnity added priority:medium This issue has medium priority and may take some time to be resolved type:docs Docs feedback or issue stat:import Status - Issue is going to be saved internally and removed stat:awaiting-triage Status - Awaiting triage from the Netcode team. labels Mar 9, 2025
@michalChrobot michalChrobot added stat:imported Status - Issue is tracked internally at Unity and removed stat:import Status - Issue is going to be saved internally labels Mar 10, 2025
NoelStephensUnity added a commit that referenced this issue Mar 28, 2025
Correcting the XML API documentation for OnGainedOwnership and
OnLostOwnership when using a distributed authority network topology.

[MTTB-1086](https://jira.unity3d.com/browse/MTTB-1086)

fix: #3345

## Changelog
NA

## Testing and Documentation

- No tests have been added.
- Includes edits to existing public API documentation.

<!-- 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.
-->
@NoelStephensUnity
Copy link
Collaborator

The XML API fix will be included in the next NGO update. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:medium This issue has medium priority and may take some time to be resolved stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report type:docs Docs feedback or issue
Projects
None yet
Development

No branches or pull requests

3 participants