AAIController::AreAIIgnoringPlayers
#include "AIController.h"
Access: public
Specifiers: static
Description
Returns whether the global AI-ignore-players flag is currently set. Use this to gate AI targeting logic so that the debug toggle actually suppresses aggression.
Caveats & Gotchas
- • This reads a global static — it applies to all AI in the world, not just a specific controller. Any AI code that factors in player awareness should check this flag if you want `ToggleAIIgnorePlayers` to have visible effect.
- • The flag is not reset between play-in-editor sessions unless you explicitly reset it or restart the process. If tests leave the flag set, subsequent PIE runs will start with AI ignoring players.
Signature
static bool AreAIIgnoringPlayers() { return bAIIgnorePlayers; } Return Type
bool Example
Guard player targeting behind the flag C++
AActor* AMyAIController::SelectAttackTarget() const
{
if (AAIController::AreAIIgnoringPlayers())
{
return nullptr;
}
// Normal target selection logic...
return FindNearestPlayer();
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?