AAIController::ToggleAIIgnorePlayers
#include "AIController.h"
Access: public
Specifiers: static
Description
Toggles a global static flag that makes all AI controllers ignore player pawns. Intended for debugging and cheat commands — useful to freeze all AI aggression during level inspection.
Caveats & Gotchas
- • This is a global toggle affecting every `AAIController` instance in the world simultaneously. There is no per-controller version — if you need selective ignoring, gate your AI logic on a per-controller flag instead.
- • The flag persists for the lifetime of the process (it is a static variable). A level travel does not reset it — always check `AreAIIgnoringPlayers()` on startup if your game uses this toggle.
Signature
static void ToggleAIIgnorePlayers() { bAIIgnorePlayers = !bAIIgnorePlayers; } Return Type
void Example
Bind to a cheat command C++
// In a UCheatManager subclass:
void UMyCheatManager::ToggleAI()
{
AAIController::ToggleAIIgnorePlayers();
UE_LOG(LogTemp, Warning, TEXT("AI ignoring players: %s"),
AAIController::AreAIIgnoringPlayers() ? TEXT("ON") : TEXT("OFF"));
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?