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: synchronizing connected clients additively loaded scenes only when server #3133

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Nov 21, 2024

This fixes the issue when starting NetworkManager as server only, connecting one or more clients, and then loading a scene and the in-scene placed NetworkObjects do not get synchronized with the clients (but once the scene is loaded late joining clients do get synchronized).

MTTB-625

Changelog

  • Fixed: In-scene NertworkObject synchronization issue when loading a scene with currently connected clients connected to a session created by a NetworkManager started as a server (i.e. not as a host).
  • Fixed: Issue where a NetworkManager started as a server would not add itself as an observer to in-scene placed NetworkObjects instantiated and spawned by a scene loading event.

Testing and Documentation

  • Includes updates to existing integration tests.
  • No documentation changes or additions were necessary.

This fixes the issue when starting NetworkManager as server only, connecting one or more clients, and then loading a scene and the in-scene placed NetworkObjects do not get synchronized with the clients (but once the scene is loaded late joining clients do get synchronized).

This had to do with an  adjustment to determining which in-scene placed NetworkObjects should be synchronized based on their observers coupled with both when running as just a server the server would not add itself to the observer list (in-scene placed only) and the update to NetworkSceneManager.SendSceneEventData where it never was updated with the more recent changes to SceneEventData (i.e. only serializing the in-scene placed NetworkObjects a client is observing) and still just queueing the message to be sent with a full list of target ids as opposed to sending each individual message while setting the SceneEventData.TargetClientId.
Updating some of the scene management related integration tests to validate the issue associated with this PR as well as adding a server (non-host) set to some of the integration tests that were only validating with a host.
adding comment and removing extra CR/LF.
adding changelog entries
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review November 21, 2024 19:14
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner November 21, 2024 19:14
Fixing issue with the updated InScenePlacedNetworkObjectTests that were using the server-side player for some of the tests which doesn't exist when it is just a server.
Fixing issue with the expected number of spawned objects since the base value was derived from TotalClients that changes when running a server.
@NoelStephensUnity NoelStephensUnity merged commit 1845a33 into develop-2.0.0 Nov 22, 2024
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/synchronizing-connected-clients-additively-loaded-scenes-only-when-server branch November 22, 2024 02:40
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.

1 participant