Skip to content

In Distributed Authority, NetworkObject can be distributed to a client that is not an observer. #3299

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
FureurTime opened this issue Feb 15, 2025 · 0 comments
Assignees

Comments

@FureurTime
Copy link

Description

With Distributed Authority topology if you spawn a NetworkObject with SpawnWithObservers = false and the property Ownership contains the flag Distributable, when a client later joins the session, that NetworkObject has a chance to be distributed to the new client (like all other distributable NetworkObject), but the object is never spawned on the new client.
The new client has authority over a NetworkObject that does not exist in its game, and for the other client that are Observers of this NetworkObject, the owner is the new client.

Reproduce Steps

  1. Set Network Topology to Distributed Authority on the NetworkManager
  2. Add the flag Distributable to the Ownership of the NetworkObject
  3. Spawn the object with this code.
networkObject.SpawnWithObservers = false;
// in DA, if SpawnWithObservers is false, the owner of the NetworkObject will be the only one added to Observers list
networkObject.Spawn();

Image

Actual Outcome

The owner of NetworkObject becomes the new client, but that client doesn't even know that it owns that NetworkObject.

Expected Outcome

NetworkObject should not be distributed to the client who does not see it.

Environment

  • OS: Windows 11
  • Unity Version: 6000.0.32f1
  • Netcode Version: 2.2.0
@FureurTime FureurTime added stat:awaiting-triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Feb 15, 2025
@EmandM EmandM added priority:medium This issue has medium priority and may take some time to be resolved stat:import Status - Issue is going to be saved internally labels Feb 20, 2025
@NoelStephensUnity NoelStephensUnity added priority:high This issue has high priority and we are focusing to resolve it and removed priority:medium This issue has medium priority and may take some time to be resolved stat:awaiting-triage Status - Awaiting triage from the Netcode team. labels Feb 20, 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 Feb 21, 2025
EmandM added a commit that referenced this issue Mar 6, 2025
…3323)

<!-- Replace this block with what this PR does and why. Describe what
you'd like reviewers to know, how you applied the engineering
principles, and any interesting tradeoffs made. Delete bullet points
below that don't apply, and update the changelog section as appropriate.
-->

<!-- Add short version of the JIRA ticket to the PR title (e.g. "feat:
new shiny feature [MTT-123]") -->
[MTTB-1041](https://jira.unity3d.com/browse/MTTB-1041)

<!-- Add RFC link here if applicable. -->

## Changelog

- Fixed: ChangeOwnership should never distribute to a client that is not
an observer of that object.

## Testing and Documentation

- No tests have been added.

<!-- 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.
-->

Closes #3299
@EmandM EmandM closed this as completed Mar 6, 2025
@EmandM EmandM removed type:bug Bug Report priority:high This issue has high priority and we are focusing to resolve it stat:imported Status - Issue is tracked internally at Unity labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants