RealDocs

AActor::K2_GetRootComponent

function Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintGetterinline

Description

Returns the actor's root scene component. This is the Blueprint-accessible getter for the RootComponent property.

Caveats & Gotchas

  • In C++ prefer GetRootComponent() directly — K2_GetRootComponent() is the Blueprint getter generated by the UPROPERTY macro and exists only to expose RootComponent via Blueprint. Both return the same value.
  • The return value can be null for actors that have not had a root component set (e.g. a plain AActor subclass with no component added in the constructor).

Signature

USceneComponent* K2_GetRootComponent() const

Return Type

USceneComponent*

Examples

Hide the actor's root component on BeginPlay Blueprint
Event BeginPlay Set Visibility Target is Scene Component Target New Visibility false false Get Root Component Target is Actor Return Value
Edit Blueprint graph Hide the actor's root component on BeginPlay
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Get root component in C++ C++
// In C++ use the direct accessor:
USceneComponent* Root = GetRootComponent();
if (Root)
{
    Root->SetWorldLocation(NewLocation);
}
// K2_GetRootComponent() is used internally by Blueprint nodes only.

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.