AAIController::GetFocusActor
#include "AIController.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallableconst
Description
Returns the actor currently set as this controller's focus target, or null if focus is on a static position or is unset.
Caveats & Gotchas
- • Returns the actor at the highest valid priority — if the movement system set a Move-priority focus during active path following, that actor is returned instead of any Gameplay-priority focus set via K2_SetFocus.
- • Returns null when K2_SetFocalPoint was used (static position focus). In that case GetFocalPoint returns the position but GetFocusActor returns null, so do not use GetFocusActor == null as a proxy for 'no focus'.
Signature
AActor* GetFocusActor() const Return Type
AActor* Example
Avoid redundant focus updates C++
void AMyAIController::UpdateCombatTarget(AActor* NewTarget)
{
if (GetFocusActor() == NewTarget)
{
return; // already tracking this actor
}
K2_SetFocus(NewTarget);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?