Skip to content
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

Invalid Destroy Error in DA When Changing Scenes #3144

Open
KadaXuanwu opened this issue Nov 28, 2024 · 2 comments
Open

Invalid Destroy Error in DA When Changing Scenes #3144

KadaXuanwu opened this issue Nov 28, 2024 · 2 comments
Assignees
Labels
Investigating Issue is currently being investigated priority:high type:bug Bug Report

Comments

@KadaXuanwu
Copy link

Description

In Distributed Authority (DA) topology, when I spawn objects using NetworkObject.Spawn(destroyWithScene: true), then change scene as SessionOwner using NetworkManager.SceneManager.LoadScene("Lobby", LoadSceneMode.Single), the network objects owned by the clients are correctly destroyed, but the SessionOwner receives an error:
Destroy a spawned NetworkObject on a non-owner client is not valid during a distributed authority session.

Additionally, unchecking Scene Migration Synchronization on the NetworkObject was required, even though in my opinion it should be irrelevant when destroyWithScene: true is set.

Reproduce Steps

  1. Set up a multiplayer game using Netcode for GameObjects (NGO) with Distributed Authority topology.
  2. In a game scene, let clients spawn their own network objects with destroyWithScene: true.
  3. Have the session owner call NetworkManager.SceneManager.LoadScene("Lobby", LoadSceneMode.Single).
  4. Observe the session owner's console output.

Actual Outcome

  • Network objects are destroyed as expected.
  • The session owner receives an error

Expected Outcome

  • Network objects should be destroyed without errors since destroyWithScene: true was explicitly set.
  • in my opinion, Scene Migration Synchronization should not require manual disabling in this context.

Screenshots

NetworkObject on an object owned by a client:
Image

Environment

Additional Context

As far as I know, the player object has to be destroyed by each client manually, where as other spawned network objects should be destroyed automatically on scene change if destroyWithScene: true. Please correct me if I'm wrong.

@KadaXuanwu KadaXuanwu added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Nov 28, 2024
@NoelStephensUnity NoelStephensUnity self-assigned this Dec 2, 2024
@NoelStephensUnity NoelStephensUnity added priority:high Investigating Issue is currently being investigated and removed stat:awaiting triage Status - Awaiting triage from the Netcode team. labels Dec 2, 2024
@NoelStephensUnity
Copy link
Collaborator

@KadaXuanwu
You make some very good points and I finally have some time later this week to setup a replication project to run through some of the issues you are describing.

Regarding the Scene Migration Synchronization, we are doing a quality pass and I am looking at the possibility of expanding the Netcode for GameObjects Project Settings to include some additional global default settings for things like NetworkObject and such where you would be able to define what default values you want when creating new component instances.

@KadaXuanwu
Copy link
Author

Thanks!

Yes, I could see this feature save some time if you have to manually add a lot of NetworkObjects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigating Issue is currently being investigated priority:high type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

2 participants