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.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.6, 4.7 |
Target Fix | 4.7nux |
Created | Dec 16, 2014 |
---|---|
Resolved | Feb 3, 2015 |
Updated | Apr 27, 2018 |