-
Notifications
You must be signed in to change notification settings - Fork 450
fix: in-scene placed NetworkObject will not spawn client-side when disabled upon being despawned [MTT-4832] #2239
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
Minor adjustments to manually validate the fixes. Integration test will follow.
…awn-clientside-when-disabled-upon-despawn-MTT-4832
Cache the NetworkManager to avoid exception during OnDestroy.
Added integration test that validates disabling NetworkObjects when despawned works with currently connected clients, late joining clients, and when scene switching (LoadSceneMode.Single) while also having the server despawn the in-scene placed NetworkObject upon its first spawn (i.e. so it starts off not visible/active to the clients when they finish the scene switch).
…awn-clientside-when-disabled-upon-despawn-MTT-4832
com.unity.netcode.gameobjects/Runtime/SceneManagement/SceneEventData.cs
Outdated
Show resolved
Hide resolved
testproject/Assets/Tests/Manual/SceneTransitioningAdditive/DespawnInSceneNetworkObject.cs
Show resolved
Hide resolved
…awn-clientside-when-disabled-upon-despawn-MTT-4832
With this fix, will it also be possible to Spawn() an object that was previously Despawn() ? So Spawn() and Despawn() at will without destroying the object ? So it keeps running on the server, but not on the client. And only sync with client under certain conditions. I think before there were issues with Spawn() an object that was previously Despawn() but not destroyed |
@Marc477 |
…sabled upon being despawned [MTT-4832] (Unity-Technologies#2239) * fix This resolves the issue with in-scene placed NetworkObjects that are disabled when despawned not being able to re-spawn again and handles synchronizing despawned in-scene placed NetworkObjects during a scene switch (LoadSceneMode.Single). * test Added integration test that validates disabling NetworkObjects when despawned works with currently connected clients, late joining clients, and when scene switching (LoadSceneMode.Single) while also having the server despawn the in-scene placed NetworkObject upon its first spawn (i.e. so it starts off not visible/active to the clients when they finish the scene switch).
If an in-scene placed
NetworkObject
'sGameObject
was disabled when it was despawned, then when the server re-spawned the same in-scene placedNetworkObject
the client-side instances would never invokeNetworkBehaviour.OnNetworkSpawn
.MTT-4832
Pertains to #2104
Changelog
NetworkObject
would not invokeNetworkBehaviour.OnNetworkSpawn
if theGameObject
was disabled when it was despawned.Testing and Documentation