RealDocs

AAIController::GetGameplayTaskDefaultPriority

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

Description

Returns the default priority for gameplay tasks initiated by this AI controller. Returns one below the global default, giving AI-initiated tasks lower priority than player-initiated ones.

Caveats & Gotchas

  • The value is `FGameplayTasks::DefaultPriority - 1` (typically 127). AI tasks won't pre-empt player-triggered tasks at the default priority — override this method if your AI should run high-priority tasks.
  • Priority affects task scheduling within the `UGameplayTasksComponent`. Higher numeric values win contention for locked resources; tasks with equal priority are handled in activation order.

Signature

virtual uint8 GetGameplayTaskDefaultPriority() const { return FGameplayTasks::DefaultPriority - 1; }

Return Type

uint8

Example

Override to give AI tasks higher priority C++
uint8 AMyAIController::GetGameplayTaskDefaultPriority() const
{
	// Make AI tasks run at the same priority as player tasks
	return FGameplayTasks::DefaultPriority;
}

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.