[Solution] How to change root component at runtime

So in order to flawlessly change root component at runtime, there are exactly three lines that need to be done

auto c = Entity->AddComponentByClass(USomeComponent::StaticClass(), true, FTransform::Identity, false)); //create
c->SetTransform(Entity->GetRootComponent()->GetComponentTransform()); //set global coords as transform
SetRootComponent(c);

That’s it.

There is a bug that will crash/freeze the editor if you try to set root component something thats already attached to the current root component (possibly some infinite loop?)

Yeah I ended up figuring this out on my own, either nobody knew how to do it or people simply didn’t care to help.

The solution is to detach everything, assign the new root, and then reattach.