AAIController::ClearFocus
#include "AIController.h"
Access: public
Specifiers: virtualAIMODULE_API
Description
Clears the focus actor and focal point for the specified priority slot. After clearing, the next-lower priority slot becomes the effective focus, or the pawn reverts to movement-direction-based rotation.
Caveats & Gotchas
- • ClearFocus clears only the specified priority slot — it does not clear all slots at once. If Move priority also has a focus set, the pawn will continue tracking that focal point.
- • In Blueprint, K2_ClearFocus (exposed as 'Clear Focus') clears only the Gameplay priority slot. The C++ version is required when managing focus at multiple priority levels.
Signature
virtual void ClearFocus(EAIFocusPriority::Type InPriority); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InPriority | EAIFocusPriority::Type | The priority slot to clear. Typically EAIFocusPriority::Gameplay unless clearing a movement-priority focus. | — |
Return Type
void Example
Clear focus when combat ends C++
void AMyAIController::OnCombatEnded()
{
ClearFocus(EAIFocusPriority::Gameplay);
// Pawn will now look in its movement direction
} Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?