The root component of a Blueprint is determined by the order in which the components are defined in the constructor of a class (the component defined first becomes the root component). Trying to set a different component as the root component does not work.
public: UPROPERTY(VisibleAnywhere, BlueprintReadOnly) UStaticMeshComponent* TheMesh; UPROPERTY(VisibleAnywhere, BlueprintReadOnly) USphereComponent* TheSphere; AMyActor(const FObjectInitializer& ObjectInitializer);
AMyActor::AMyActor(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { TheSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("TheSphere")); TheMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("TheMesh")); RootComponent = TheMesh; }
RESULTS:
TheSphere component is still the root component.
EXPECTED:
TheMesh component is the root component.
Head over to the existing Questions & Answers thread and let us know what's up.