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: distributed authority spawning prefab overrides #3160

Merged

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Dec 8, 2024

This PR resolves an issue discovered in NGO example (#3161) where only the session owner would use the proper base GlobalObjectIdHash when spawning prefab overrides. Now, all clients are treated like a host (regarding spawning and prefab overrides) and will use the base GlobalObjectIdHash value when sending a CreateObjectMessage.

This PR also resolves a discovered issue where a server-only NetworkManager instance could spawn the network prefab instance itself as opposed to making an instance of the prefab and spawning the new instance.

Changelog

  • Fixed: Issue where a sever only NetworkManager instance would spawn the actual NetworkPrefab's GameObject as opposed to creating an instance of it.
  • Fixed: Issue where only the session owner (as opposed to all clients) would handle spawning prefab overrides properly when using a distributed authority network topology.

Testing and Documentation

  • Includes update to unit test: NetworkPrefabHandlerTests.NetworkPrefabHandlerClass
  • Includes NetworkPrefabOverrideTests integration test.
  • No documentation changes or additions were necessary.

All clients in distributed authority should invoke CheckForGlobalObjectIdHashOverride when spawning a NetworkPrefab since each client has the authority to spawn (i.e. each should be treated like a host/server in regards to spawning and prefab overrides).
adding changelog entry.
adding changelog PR number.
updating existing test to run through with distributed authority and client-server network topologies.
(still need one more integration test to validate the final spawned object on the non-authority sides)
removing whitespace
Fixed issue with server only NetworkManager instance spawning the network prefab itself as opposed to creating an instance.
Extracted the instantiation portion of a network prefab into an internal method that can be used for integration testing prefab instantiation and potentially other edge case scenarios.
Migrated all runtime network prefab related tests into a Prefabs subfolder.
Added new NetworkPrefabOverrideTests to validate the actual spawned instances on all clients using both client-server and distributed authority network topologies.
Added helper method `NettcodeIntegrationTestHelpers.CreateNetworkObject`.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review December 9, 2024 00:09
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner December 9, 2024 00:09
correcting some typos in comments
@NoelStephensUnity NoelStephensUnity merged commit 88eaa08 into develop-2.0.0 Dec 9, 2024
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/distributed-authrity-prefab-override branch December 9, 2024 23:30
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