@@ -118,29 +118,42 @@ public void Handle(ref NetworkContext context)
118118 // DANGO-TODO: Still determining if we should not apply this change (I am leaning towards not allowing it).
119119 }
120120
121+
121122 networkObject . SetNetworkParenting ( LatestParent , WorldPositionStays ) ;
122123 networkObject . ApplyNetworkParenting ( RemoveParent ) ;
123124
124- // This check is primarily for client-server network topologies when the motion model is owner authoritative:
125- // When SyncOwnerTransformWhenParented is enabled, then always apply the transform values.
126- // When SyncOwnerTransformWhenParented is disabled, then only synchronize the transform on non-owner instances.
127- if ( networkObject . SyncOwnerTransformWhenParented || ( ! networkObject . SyncOwnerTransformWhenParented && ! networkObject . IsOwner ) )
125+ #if UNIFIED_NETCODE
126+ if ( networkObject . HasGhost )
128127 {
129- // We set all of the transform values after parenting as they are
130- // the values of the server-side post-parenting transform values
131- if ( ! WorldPositionStays )
132- {
133- networkObject . transform . SetLocalPositionAndRotation ( Position , Rotation ) ;
134- }
135- else
128+ // Handles the GhostAdapter side of things for parenting
129+ networkObject . NetworkObjectBridge . HybridParentUpdate ( Scale ) ;
130+ }
131+ else
132+ #endif
133+ {
134+ // This check is primarily for client-server network topologies when the motion model is owner authoritative:
135+ // When SyncOwnerTransformWhenParented is enabled, then always apply the transform values.
136+ // When SyncOwnerTransformWhenParented is disabled, then only synchronize the transform on non-owner instances.
137+ if ( networkObject . SyncOwnerTransformWhenParented || ( ! networkObject . SyncOwnerTransformWhenParented && ! networkObject . IsOwner ) )
136138 {
137- networkObject . transform . SetPositionAndRotation ( Position , Rotation ) ;
139+
140+ // We set all of the transform values after parenting as they are
141+ // the values of the server-side post-parenting transform values
142+ if ( ! WorldPositionStays )
143+ {
144+ networkObject . transform . SetLocalPositionAndRotation ( Position , Rotation ) ;
145+ }
146+ else
147+ {
148+ networkObject . transform . SetPositionAndRotation ( Position , Rotation ) ;
149+ }
150+ networkObject . transform . localScale = Scale ;
138151 }
139- networkObject . transform . localScale = Scale ;
140152 }
141153
142154 // If in distributed authority mode and we are running a DAHost and this is the DAHost, then forward the parent changed message to any remaining clients
143- if ( ( networkManager . DistributedAuthorityMode && ! networkManager . CMBServiceConnection && networkManager . DAHost ) || ( networkObject . AllowOwnerToParent && context . SenderId == networkObject . OwnerClientId && networkManager . IsServer ) )
155+ if ( ( networkManager . DistributedAuthorityMode && ! networkManager . CMBServiceConnection && networkManager . DAHost )
156+ || ( networkObject . AllowOwnerToParent && context . SenderId == networkObject . OwnerClientId && networkManager . IsServer ) )
144157 {
145158 var size = 0 ;
146159 var message = this ;
0 commit comments