Skip to content

fix: NetworkSceneManager does not synchronize despawned in-scene placed NetworkObjects [MTT-2924]#1898

Merged
NoelStephensUnity merged 71 commits intodevelopfrom
fix/mtt-2924-despawned-scene-objects-dont-synchronize-late-joining-clients
May 9, 2022
Merged

fix: NetworkSceneManager does not synchronize despawned in-scene placed NetworkObjects [MTT-2924]#1898
NoelStephensUnity merged 71 commits intodevelopfrom
fix/mtt-2924-despawned-scene-objects-dont-synchronize-late-joining-clients

Conversation

@NoelStephensUnity
Copy link
Copy Markdown
Member

@NoelStephensUnity NoelStephensUnity commented Apr 22, 2022

This resolves the issue where an in-scene placed NetworkObject could be despawned prior to a client joining and the client-side in-scene placed NetworkObject component's would not receive a despawn notification when synchronizing.

This also greatly reduces user pain by not requiring users to register in-scene placed NetworkObjets with the NetworkManager using prefab hash overrides. Instead, it just uses the table of in-scene NetworkObjects that were already being tracked by the NetworkSceneManager.

MTT-2924

Changelog

  • Fixed: NetworkSceneManager does not synchronize despawned in-scene placed NetworkObjects.
  • Changed: requirement to register in-scene placed NetworkObjects with NetworkManager in order to respawn them. In-scene placed NetworkObjects are now automatically tracked during runtime and no longer need to be registered as a NetworkPrefab.

Testing and Documentation

  • Includes manual test (Additive Scene Loading: Backspace on server spawns/despawns the green in-scene NetworkObject)
  • Includes integration test updates.
  • Includes integration test: InScenePlacedNetworkObjects

NetcodeIntegrationTest Updates:

image
The image above is an integration test that has two (2) clients and (1) host where the host loaded a scene that has in-scene placed NetworkObjects. If the in-scene NetworkObject has the TestHelper ObjectNameIdentifier component, then like in the above image you will be able to visually distinguish between each relative instance.

MTT-2924
This is the first pass at solving the issue where late joining clients are not synchronized properly with despawned in-scene NetworkObjects.
@NoelStephensUnity NoelStephensUnity marked this pull request as draft April 22, 2022 23:23
NoelStephensUnity and others added 4 commits April 25, 2022 08:34
This allows for respawning of in-scene placed NetworkObjects without having to register them with the NetworkManager.
Comment thread com.unity.netcode.gameobjects/CHANGELOG.md Outdated
NoelStephensUnity and others added 17 commits April 25, 2022 15:18
whitespace fixes.
Passing the entire SceneObject structure as opposed to adding more parameters to the NetworkSpawnManager.HasPrefab method in order to be able to extract the NetworkSceneHandle and include the in-scene placed NetworkObjects as part of the "prefabs to search for".
This is some work towards integration tests where clients might be able to actually load scenes as opposed to fake loading them
Fixed some minor issues with tests.
Updated HiddenVariableTests as it needed some timing related adjustments.
This update allows for clients to load scenes and synchronize in-scene placed NetworkObjects during integration testing.
Now that clients are loading scenes, needed to make some minor adjustments.
Realized I don't need to simulate client loading delay unless the client is blocked from loading.
Also had to adjust whether the metrics tests waited for the client or not when loading.
Testing with verbose mode to see why this passes on Windows 10 in a stand alone build and in the editor but fails on Yamato desktops.
adding more debug info.
Looks like the scene isn't really loaded when it says it is loaded.
Moving when the NetworkSceneManager's callback is invoked and adding delay before invoking.
Making some additional modifications to see if it was when the NetworkSceneManager scene Load/Unload event action is invoked and reducing the number of clients to 1.
Minor tweaks and merging develop into this branch.
Found a bug in some recent changes that would cause a crash under specific scenarios.
@NoelStephensUnity NoelStephensUnity marked this pull request as draft April 29, 2022 18:02
NoelStephensUnity and others added 4 commits May 1, 2022 14:35
Went back through some of the changed files and removed some code no longer needed, extended some of the verbose debug info for any future debugging purposes, and updated some of the comments.
removing commented out code.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review May 2, 2022 01:50
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner May 5, 2022 17:41
@JesseOlmer JesseOlmer changed the title fix: NetworkSceneManager does not synchronize despawned in-scene placed NetworkObjects fix: NetworkSceneManager does not synchronize despawned in-scene placed NetworkObjects [MTT-2924] May 5, 2022
@JesseOlmer JesseOlmer closed this May 5, 2022
@JesseOlmer JesseOlmer reopened this May 5, 2022
@JesseOlmer
Copy link
Copy Markdown
Contributor

Closed and re-opened to fix the JIRA association. Please make sure to add the JIRA ticket to the title upon PR creation in the future.

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.

5 participants