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: NetworkObject component should always precede NetworkBehaviour components [MTT-7216] #2685

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Aug 30, 2023

This fixes the issue where it was possible for a NetworkObject component to be positioned after NetworkBehaviour components which could result in the NetworkBehaviour components that preceded the NetworkObject component to not have their OnNetworkDespawn method invoked on an in-scene placed NetworkObject when the scene was unloaded during a scene transition.

MTT-7216

Changelog

  • Fixed: Issue where a NetworkBehaviour component's OnNetworkDespawn was not being invoked on the host-server side for an in-scene placed NetworkObject when a scene was unloaded (during a scene transition) and the NetworkBehaviour component was positioned/ordered before the NetworkObject component.

Testing and Documentation

  • Includes unit test NetworkObjectTests.NetworkObjectComponentOrder
  • No documentation changes or additions were necessary.

MTT-7216
This resolves the issue where an in-scene placed NetworkObject can have NetworkBehaviour components not invoke the OnNetworkDespawn method when doing a full scene transition (LoadSceneMode.Single) due to the way GameObjects destroy the attached components.
adding check for null
missed adding a white space
This is a unit test to validate the re-ordering of the NetworkObject component.
adding change log entry for this fix.
removing "auto-added" namespace...
removing un-used namespace.
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner August 30, 2023 17:39
@NoelStephensUnity NoelStephensUnity merged commit f59f5e6 into develop Aug 30, 2023
1 check passed
@NoelStephensUnity NoelStephensUnity deleted the fix/networkobject-component-should-precede-networkbehaviours branch August 30, 2023 20:25
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