NetworkTransform does not sync for the Host

Hey Everyone,

I’m experiencing a very strange issue in which Network Transform component syncs properly for all clients except for the Host/Server client.

Netcode for GameObjects 2.2.0
Unity 6.0

I have a Network Transform component attached to a root GameObject with no children. The Authority mode is set to Owner. When the Host is the owner of the object, any changes to the transform are synched as expected across all connected clients. When a non-host client is the owner of the object, however, the transform state syncs for all connected clients except for the host.

I have confirmed that, in this situation, the Network Object component shows the correct client as the owner. All other NetworkBehaviour NetworkVariables sync appropriately. OnNetworkTransformStateUpdated never runs on the Host, but does run for all other non-owner clients. Another interesing note is that, if the object is spawned with a non-host client as the owner, the transform state will sync perfectly for the host until they take ownership of the object. From that point on, regardless of who the owner is, the transform state will be desynced just on the Host.

I’ve spent a few hours testing and just can’t figure this one out. The server must be receiving and propogating the transform state to the other clients, but for some reason it just refuses to apply it to the object. Is this a known NGO bug?

Any guidance or advice on this would be greatly appreciated.

After a few hours, I’m still digging into the root cause, but it seems part of the issue is that the Server/Host sets the NetworkObject.PreviousOwnerId to the new owner before running OnOwnershipChanged.
This means it never runs InternalInitialize and never registers the tranform to the network manager with m_CachedNetworkManager.NetworkTransformRegistration;

NetworkBehaviourUpdater - line 113

NetworkTransform- Line 3375

Console

For now I implemented a temporary fix to force internal intialization and, in turn, registration, and it seems to be working, but I am unsure if this will have any unintended side effects

Temporary fix -NetworkTransform- Line 3375

I have experience the exact same issue. Ownership works correctly but only on the host its not synced.
But for me this only happens when I set a network variable value linked to the same NetworkObject.

It appears to be a mayor bug.

Hey!

I was facing the same issue until I found your post! I spent three days struggling to figure out why my GameObject wasn’t syncing with the server… You saved me, man! I hope Unity becomes aware of this bug soon.

Had the same issue with an In Editor spawned prefab with a NetworkVariable and NetworkList in a component attached to it. Upgrading to 2.3.2 fixed the issue, but I also want to note that sullivanml299’s fix works as well for 2.3.0.