timers-and-async

Implement timers, async tasks, and background threads in Unreal Engine C++.

1|Updated Sep 6, 2026
One-click install
npx skills add https://github.com/ziyarduc/Baran-bk-game --skill timers-and-async-ziyarduc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: timers-and-async
Source: https://github.com/ziyarduc/Baran-bk-game/tree/main/.agents/skills/timers-and-async
Command: npx skills add https://github.com/ziyarduc/Baran-bk-game --skill timers-and-async-ziyarduc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Unreal Engine gameplay code often needs delayed callbacks, repeating logic, or CPU-heavy work offloaded from the game thread, and choosing the wrong mechanism causes dangling-pointer crashes, GC hazards, or frame stalls. This Skill provides verified UE 5.8 patterns for FTimerManager, Async/AsyncTask, the UE Tasks System, FRunnable threads, and FTSTicker so you pick the right tool and use it safely. ## Core Features & Use Cases - Gameplay Timers: Set looping or one-shot timers with FTimerHandle, defer one frame with SetTimerForNextTick, pause/query/clear timers, and enforce mandatory EndPlay cleanup. - Async & Tasks System: Offload heavy computation with Async(EAsyncExecution::ThreadPool), marshal results back to the game thread, and build dependency graphs with UE::Tasks::Launch, FTask, and FPipe. - Threads & Tickers: Run long-lived dedicated threads with FRunnable/FRunnableThread and tick non-actor subsystems with FTSTicker, with strict thread-safety rules for UObject access. - Use Case: You need a health regen tick every 0.5 seconds and a procedural map generation pass on a worker thread. Use SetTimer with a stored FTimerHandle for regen, and Async with a TWeakObjectPtr capture plus AsyncTask(ENamedThreads::GameThread) to apply results safely. ## Quick Start Ask the assistant to implement a looping regen timer and a background computation task for your Unreal C++ actor using this skill.

Frequently Asked Questions about timers-and-async

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set a repeating timer in Unreal Engine C++?▼

Call GetWorldTimerManager().SetTimer with a stored FTimerHandle, the object and method pointer, a rate in seconds, and bLoop set to true. Keep the handle as a member so you can pause, query, or clear the timer later.

How to run code on a background thread in Unreal Engine?▼

Use Async(EAsyncExecution::ThreadPool, Lambda) for short-to-medium work or UE::Tasks::Launch for dependency graphs. Marshal results back with AsyncTask(ENamedThreads::GameThread, ...) since UObjects and actors must only be touched on the game thread.

What is the difference between FTimerManager and FTSTicker?▼

FTimerManager is per-UWorld, respects time dilation and pausing, and suits actor logic. FTSTicker is a thread-safe global ticker for non-actor subsystems that need periodic callbacks independent of any world.

Can I capture a UObject pointer in an async lambda?▼

No, capturing a raw UObject pointer across threads is unsafe because garbage collection can destroy it while the lambda runs. Capture a TWeakObjectPtr instead and call Get() to re-validate once back on the game thread.

Why does my timer crash after the actor is destroyed?▼

A looping timer whose lambda captures a raw this pointer does not auto-invalidate when the actor is destroyed. Clear every looping timer in EndPlay using ClearTimer so the delegate never fires on freed memory.

When should I use FRunnable instead of Async or the Tasks System?▼

Use FRunnable with FRunnableThread only for long-running dedicated threads like streaming or simulation loops. For bounded work that finishes and releases the thread, prefer Async or UE::Tasks::Launch, which share the thread pool.