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

fix: client owned NetworkObject with prefabhandler destroy order incorrect on host-server side #3200

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Jan 10, 2025

Replication of the issue is as follows:

  • Using a client-server network topology
    • At least one client must be connected to a host or server.
  • NetworkObjects are spawned with:
    • Ownership belonging to a connected client.
      • Does not occur if they are owned by the server.
    • Don't destroy with owner is not enabled (i.e. it will destroy when the client leaves)
      • Does not occur if don't destroy with owner is enabled.
  • While the NetworkObjects (owned by the client) are still spawned, the client disconnects.

NGO v2: On the host/server side, this will cause the destroy method to be invoked twice.
Backport to v1: #3202

fix: #3190

Changelog

Fixed: Issue where a spawned NetworkObject that was registered with a prefab handler and owned by a client would invoke destroy more than once on the host-server side if the client disconnected while the NetworkObject was still spawned.

Testing and Documentation

  • Includes updates to NetworkPrefabOverrideTests.
  • No documentation changes or additions were necessary.

Pass in false for the destroy object parameter when cleaning up objects owned by a client upon the client disconnecting and the spawned objects have a prefab handler registered for their associated network prefab.
adding change log entry.
Cleaning up the connection manager.
Removing the warning about a client having nothing that it owns spawned (could be a valid design pattern and no reason to spam the message upon a client disconnecting if it is intentional).
Updated NetworkPrefabOverrideTests to add a validation check for this PR
Adding PR number to changelog entry.
remove whitespaces
remove unused namespace
@NoelStephensUnity NoelStephensUnity merged commit 53ec0e6 into develop-2.0.0 Jan 10, 2025
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/client-owned-networkobject-destroy-order-incorrect-prefabhandler branch January 10, 2025 21:48
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

Successfully merging this pull request may close these issues.

2 participants