AActor::PrimaryActorTick
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYEditDefaultsOnly
Description
The primary tick function for this actor. Controls whether ticking is enabled, the tick interval, tick group, and prerequisite dependencies. Call PrimaryActorTick.bCanEverTick = true in the constructor to enable ticking.
Caveats & Gotchas
- • Tick is disabled by default on AActor. You must set PrimaryActorTick.bCanEverTick = true in the constructor — doing it in BeginPlay or later has no effect because tick registration happens before BeginPlay.
- • Changing PrimaryActorTick.TickInterval at runtime only takes effect on the next tick cycle, not immediately.
- • PrimaryActorTick is an FActorTickFunction value type, not a pointer. Passing it by address to AddTickPrerequisiteActor requires care about object lifetime.
Signature
UPROPERTY(EditDefaultsOnly, Category=Tick)
struct FActorTickFunction PrimaryActorTick; Example
Enable ticking in constructor C++
AMyActor::AMyActor()
{
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.TickInterval = 0.1f; // Tick at 10 Hz instead of every frame
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?