Skip to content

fix: client-server owner authoritative nested NetworkTransform invalid synchronization #3099

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

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Oct 14, 2024

This is a special case for client-server where a server is spawning an owner authoritative NetworkObject but has yet to serialize anything. When the server detects that:

  • We are not in a distributed authority session (DAHost check).
  • This is the first/root NetworkTransform.
  • The root NetworkTransform is owner authoritative.
  • The NetworkObject is not owned by the server.
  • The SynchronizeState.IsSynchronizing is set to false.
    Then the server would skip the final initialization step which resulted in the loss of the initial SynchronizeState settings.

This PR checks for the above conditions during the initial spawning of a NetworkObject and then:

  • Makes sure the SynchronizingState is updated to the instantiated prefab's default flags/settings.
  • Forces the SynchronizingState.IsSynchronizing flag so the NetworkTransform runs through the final initialization steps.

MTTB-483

fix: #3082

Changelog

  • Fixed: Issue with nested NetworkTransform components clearing their initial prefab settings when in owner authoritative mode on the server side while using a client-server network topology which resulted in improper synchronization of the nested NetworkTransform components.

Testing and Documentation

  • Includes integration test updates.
  • No documentation changes or additions were necessary.

This fixes the issue when using a client-server network topology spawning a player with nested NetworkTransform components would result in loss of the child NetworkTransform component(s) settings/flags which would end up being serialized to the owner client (thus causing invalid synchronization results).
Adding the changelog entry.
The issue is not just for local players but for all prefabs that have nested NetworkTransforms, are owner authoritative, are not owned by the server, and the session instance is using a client-server network topology.
Adding a test to validate this fix.
adding PR number to changelog entry
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review October 14, 2024 22:46
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner October 14, 2024 22:46
@NoelStephensUnity NoelStephensUnity merged commit 3625247 into develop-2.0.0 Oct 14, 2024
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/client-server-owner-authoritative-nested-networktransform-invalid-synch branch October 14, 2024 23:49
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