Search Issue Tracker

Fixed

Fixed in 2.2.0

Votes

0

Found in [Package]

2.0.0

Issue ID

MTTB-624

Regression

Yes

Netcode for GameObjects 2.0 - Client network objects not syncing after scene loading

Package: Multiplayer Netcode for GameObjects

-

When loading a scene using NetworkManager.SceneManager, in scene NetworkObjects in the newly loaded scene are not synced for clients that were previous already connected. Clients that join after the scene has loaded are correctly synced

*Steps to reproduce:*
# Server {{S}} is running and has one connected client {{{}A{}}}.  They are both in a starting scene {{{}Main{}}}.
# {{S}} calls {{NetworkSceneManager.LoadScene}} with {{LoadSceneMode.Additive}} loading scene {{{}Game{}}}.  Scene {{Game}} contans an in-scene {{NetworkObject}} with a {{{}NetworkBehaviour{}}}-derived component {{{}o{}}}.
# After the scene transition, a new client {{B}} connects.
**   {{B}} was previously in scene {{Main}} before connecting, and on connecting it correctly loads {{Game}} additively to bring it into the same state as {{S}} and {{{}A{}}}.
# {*}Here's the bug{*}:  {{o.OnNetworkSpawn}} is *not called* on client {{{}A{}}}, the preexisting client who was brought into the scene along with the server.  It *is* called on the server itself {{S}} as well as on the late-joining client {{{}B{}}}.
** Updates to NetworkVariables updates on {{o}} the happen on the server {{S}} are *correctly* handed by the late-joining client {{B}} but cause errors on client {{{}A{}}}.

*Actual results:* 

Client A sees:
{{A}} sees this:
{code:java}
[Netcode] [Deferred OnSpawn] Messages were received for a trigger of type NetworkVariableDeltaMessage associated with id (1), but the NetworkObject was not received within the timeout period 10 second(s). UnityEngine.Debug:LogWarning (object) Unity.Netcode.NetworkLog:LogWarning (string) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Logging/NetworkLog.cs:28) Unity.Netcode.DeferredMessageManager:PurgeTrigger (Unity.Netcode.IDeferredNetworkMessageManager/TriggerType,ulong,Unity.Netcode.DeferredMessageManager/TriggerInfo) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/DeferredMessageManager.cs:117) Unity.Netcode.DeferredMessageManager:CleanupStaleTriggers () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Messaging/DeferredMessageManager.cs:84) Unity.Netcode.NetworkManager:NetworkUpdate (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkManager.cs:374) Unity.Netcode.NetworkUpdateLoop:RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:191) Unity.Netcode.NetworkUpdateLoop/NetworkPostLateUpdate/<>c:<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs:286){code}

Filling out my comment {_}"the inspector for it looks different"{_}...  On the bad client {{A}} (the client that was already joined), the inspector for the NetworkObject looks {*}the same in play mode as it does in edit mode{*}, with fields {{{}Always Replicate As Root{}}}, {{{}Synchronize Transform{}}}, etc. etc. etc.On both the server and the good client {{{}B{}}}, the NetworkObject inspector in play mode looks as you would expect, with {{{}GlobaObjectIdHash{}}}, {{{}NetworkObjectId{}}}, {{{}OwnerClientId{}}}, etc. etc. etc.  {{IsOwner}} is true on the server and not on the client... exactly as you would expect.
 
... and breaking in {{{}NetworkObjectEditor.OnInspectorGUI{}}}, on the bad client,  {{m_NetworkObject.IsSpawned}} is false.
*Expected results:* 

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).
*Reproducible with versions:* 

NGO version 2.0.0

Editor: Unity 6000.0.26

OS: Mac

*Not reproducible with versions:* 

*Can’t test with versions:* 

*Tested on (OS):* 

*Notes:*
* [https://unity3d.zendesk.com/agent/tickets/1999260]

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.