Setting RootComponent in C++ constructor doesn't actually change the root component

The root component (at least when viewing in the components tab of a derived BP) is always the subobject i created first in the constructor with FObjectInitializer::CreateDefaultSubobject. Changing the order of these around changes what the root component ends up being. All that setting RootComponent variable or using SetRootComponent method in the constructor does is remove the dummy ‘Root Component’ that shows up in the blueprint components tab when you forget to set it.

engine 4.6.0

Hi rajkosto,

Sorry for not getting back to you on this issue sooner. I was able to reproduce the results that you described, and I have submitted a report about this issue to have it investigated further (UE-6769).

Is this fixed?

Hi SuKim,

This issue was fixed a while ago. If you are seeing this happen again, please create a new post on AnswerHub with details about what you are seeing and the steps that you are taking to get those results.


This still happens in UE 5.1.
The first component created using CreateDefaultSubObject becomes the RootComponent automatically.