RealDocs

AActor::IsRootComponentStatic

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

Description

Returns true if the actor's root component has a mobility of EComponentMobility::Static. Useful for optimisation checks and lighting validation.

Caveats & Gotchas

  • Returns false if the actor has no root component. Always ensure a root component exists before relying on this result for decision-making.
  • Static mobility is baked at cook time for lighting. Changing mobility at runtime via SetMobility() does not retroactively affect lightmap data, so this query is more meaningful in editor or construction-time code.

Signature

ENGINE_API bool IsRootComponentStatic() const;

Return Type

bool

Example

Skip dynamic tick for static actors C++
void AMyActor::BeginPlay()
{
    Super::BeginPlay();
    if (IsRootComponentStatic())
    {
        // No need to tick; actor will never move
        SetActorTickEnabled(false);
    }
}

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.