RealDocs

AAIController::OnGameplayTaskActivated

function AIModule Since 4.12
#include "AIController.h"
Access: public Specifiers: virtualoverride

Description

Called when a gameplay task owned by this controller transitions to the active state. The base implementation is empty — override to track active tasks or apply side effects when a task starts.

Caveats & Gotchas

  • Like `OnGameplayTaskInitialized`, the empty body exists to suppress linker errors when `GameplayTasks` is not a build dependency. Add the module if you override this.
  • A task can be re-activated after being paused — this callback fires for each activation, not just the first. Check `Task.IsActive()` vs a first-time flag if you need one-shot logic.

Signature

virtual void OnGameplayTaskActivated(UGameplayTask& Task) override {}

Parameters

Name Type Description Default
Task UGameplayTask& The task that has just become active.

Return Type

void

Example

Track the currently active task C++
void AMyAIController::OnGameplayTaskActivated(UGameplayTask& Task)
{
	Super::OnGameplayTaskActivated(Task);
	ActiveTask = &Task;
}

Version History

Introduced in: 4.12

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.