UE allows actors to be attached to other actors. More precisely, it allows the root component of an actor (child) to be attached to any component of another actor (parent). From now on, "parent" and "child" refer to this kind of attachment, and not to the use of ChildActorComponent.
When function "AttachActorToComponent" is used with the root component of the parent actor, everything works correctly. When running a game, calling that function with a non-root parent component also works as expected. However, inside the Editor, the resulting hierarchy after an attachment to a non-root parent component is not properly handled across some operations. After such an attachment:
A) Moving/Rotating the parent actor, or the parent actor's root component, makes the child actor snap to its parent component (incorrectly loses its relative transform)
B) Canceling the movement/rotation of the parent actor with the ESC key breaks the attachment completely
C) Recompiling the blueprint of the parent actor reattaches the child actor to the root component of the parent (incorrectly loses its previous parent component)
The behaviors above were tested in UE 5.2.1 and UE 5.4.2. The reason for (A) seems to be related to the implementation of AActor::RerunConstructionScripts(). After passing the check "if (bUseRootComponentProperties)", a structure "FAttachedActorInfo" is built with a zero "Relative Transform", and later the attachment is done with rule "FAttachmentTransformRules::SnapToTargetIncludingScale". This might be a consequence of having no "ActorTransactionAnnotation" available, but the preliminary investigation did not go that far.
Interestingly, in UE 4.27.2, operations (A) and (C) above result in the incorrect reattachment of the child actor to the root component of the parent (but no snapping as in (A) above). In UE 4.23.1, moving the parent actor's root component results in correct behavior, but moving the parent actor itself (not selecting its root component in the details panel) also gives the same results as in 4.27. The preliminary investigation did not check earlier versions of the engine.
Test (A)
Test (B)
Test (C)
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-219163 in the post.
0 |
Component | UE - Editor - Workflow Systems |
---|---|
Affects Versions | 5.4.2, 5.2.1, 4.23.2, 4.27.2 |
Created | Jul 3, 2024 |
---|---|
Updated | Jul 16, 2024 |