AttachToComponent silently discards attachment when target is simulating physics, leaving AttachParent null after re-registration

Summary

USceneComponent::AttachToComponent() early-outs with the warning “… is simulating physics. Aborting.” when the component (or the attach target) is simulating physics. This is reasonable as a runtime guard, but the same code path also runs during component re-registration flows — most notably when returning from PIE to the editor world while bSimulatePhysics is serialized as true on a component.
In that case, the attachment restoration performed during registration is silently aborted and the child component is left with AttachParent == nullptr. The engine neither retries the attachment after physics is torn down nor reports an error; the hierarchy is just permanently lost. Child components of the affected component also end up detached, even though enabling physics simulation at runtime is only supposed to detach the simulating component itself (with children continuing to follow it).
As a workaround, we have to run defensive fix-up code (re-attaching orphaned subobjects to their intended parents) in OnRegister() / PostLoad(), and we must force bSimulatePhysics off outside of game worlds.

What Type of Bug are you experiencing?

Editor

Steps to Reproduce

  1. Create an actor with a native root primitive component and child scene components (e.g. mesh components created with CreateDefaultSubobject and attached to the root).
  2. Enable Simulate Physics on the root primitive component in the Details panel (so it is serialized as true in the editor world).
  3. Start PIE, then stop PIE.
  4. Observe the log for “… is simulating physics. Aborting.” during the editor-world re-registration.
  5. Inspect the actor’s component hierarchy (or GetAttachParent() of the children).

Expected Result

Attachment restoration during registration either succeeds (physics is not yet active at that point), is deferred until it can succeed, or fails loudly with a clear error. The component hierarchy serialized in the asset/level is preserved.

Observed Result

AttachToComponent aborts silently, AttachParent remains null, and the component hierarchy is permanently broken in the editor world. No ensure or error is raised beyond a single log warning that is easy to miss.

Affects Versions

5.7

Platform(s)

Windows