AActor::GetWorldTimerManager
#include "GameFramework/Actor.h"
Access: public
Description
Returns a reference to the world's FTimerManager, which is used to set, clear, and query timers. This is the canonical way to access timers from inside an actor.
Caveats & Gotchas
- • Must not be called before the actor has a valid world (e.g., in the constructor or before `BeginPlay`). The reference is obtained from the actor's world; if `GetWorld()` returns null the call will crash.
- • Timers set via the world timer manager are automatically paused when the game is paused unless you explicitly mark them with `bIgnorePause = true` in `SetTimer`.
Signature
ENGINE_API class FTimerManager& GetWorldTimerManager() const Return Type
FTimerManager& Example
Set a repeating timer C++
void AMyActor::BeginPlay()
{
Super::BeginPlay();
GetWorldTimerManager().SetTimer(
TimerHandle,
this,
&AMyActor::OnTimerFired,
2.0f, // interval
true // loop
);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?