AAIController::OnGameplayTaskInitialized
#include "AIController.h"
Access: public
Specifiers: virtualoverride
Description
Called by the GameplayTasks system when a task owned by this controller is initialized. The base implementation is intentionally empty — override to react to task creation before it activates.
Caveats & Gotchas
- • The empty override exists solely to fix linker errors for projects that use `AAIController` without adding the `GameplayTasks` module to their build dependencies. If you override this, add `GameplayTasks` to your module's `PublicDependencyModuleNames`.
- • This fires before `OnGameplayTaskActivated`. The task is not yet running — avoid calling task methods that require an active state.
Signature
virtual void OnGameplayTaskInitialized(UGameplayTask& Task) override {} Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Task | UGameplayTask& | The task that has just been initialized. | — |
Return Type
void Example
Log task initialization for debugging C++
void AMyAIController::OnGameplayTaskInitialized(UGameplayTask& Task)
{
Super::OnGameplayTaskInitialized(Task);
UE_LOG(LogAI, Verbose, TEXT("Task initialized: %s"), *Task.GetName());
} Tags
Version History
Introduced in: 4.12
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?