File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
com.unity.netcode.gameobjects/Runtime/Spawning Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -929,20 +929,18 @@ internal NetworkObject CreateLocalNetworkObject(NetworkObject.SceneObject sceneO
929929 var parentNetworkObject = networkObject . transform . parent . GetComponent < NetworkObject > ( ) ;
930930
931931 // special case to handle being parented under a GameObject with no NetworkObject
932- nonNetworkObjectParent = ! parentNetworkObject && ! sceneObject . HasParent ;
932+ nonNetworkObjectParent = ! parentNetworkObject && sceneObject . HasParent ;
933933
934- // if the in-scene placed NetworkObject has a parent NetworkObject but the synchronization information does not
935- // include parenting, then we need to force the removal of that parent (i.e. it is at the root)
934+ // If the in-scene placed NetworkObject has a parent NetworkObject...
936935 if ( parentNetworkObject )
937936 {
938- // Remove the parent if:
937+ // Then remove the parent only if:
939938 // - The authority says we don't have a parent (but locally we do).
940939 // - The auhtority says we have a parent but either of the two are true:
941940 // -- It isn't the same parent.
942941 // -- It was parented using world position stays.
943- var removeParent = ! sceneObject . HasParent || ( sceneObject . IsLatestParentSet
944- && ( sceneObject . LatestParent . Value != parentNetworkObject . NetworkObjectId || sceneObject . WorldPositionStays ) ) ;
945- if ( removeParent )
942+ if ( ! sceneObject . HasParent || ( sceneObject . IsLatestParentSet
943+ && ( sceneObject . LatestParent . Value != parentNetworkObject . NetworkObjectId || sceneObject . WorldPositionStays ) ) )
946944 {
947945 // If parenting without notifications then we are temporarily removing the parent to set the transform
948946 // values before reparenting under the current parent.
You can’t perform that action at this time.
0 commit comments