Description

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.

Steps to Reproduce
  1. Create a new code project using the First Person template.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new code class to the project derived from Actor. Name the class MyActor.
  5. Close the Editor.
  6. In the header file for the new class, add the following code:
    public:
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
    	UStaticMeshComponent* TheMesh;
    
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
    	USphereComponent* TheSphere;
    
    	AMyActor(const FObjectInitializer& ObjectInitializer);
    
  7. In the code file for the new class, add the following code:
    AMyActor::AMyActor(const FObjectInitializer& ObjectInitializer)
    	: Super(ObjectInitializer)
    {
    	TheSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("TheSphere"));
    
    	TheMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("TheMesh"));
    
    	RootComponent = TheMesh;
    }
    
  8. Build the project in Visual Studio.
  9. Open the project in the Editor.
  10. Create a new Blueprint derived from the new MyActor class.
  11. Open the Blueprint and go to the Components tab.

RESULTS:
TheSphere component is still the root component.

EXPECTED:
TheMesh component is the root component.

Have Comments or More Details?

Head over to the existing AnswerHub thread and let us know what's up.

0
Login to Vote

Fixed
ComponentGameplay - Blueprint
Affects Versions4.64.7
Target Fix4.7nux
Fix Commit2430292
Release Commit2430292
CreatedDec 16, 2014
ResolvedFeb 3, 2015
UpdatedApr 27, 2018