APawn::AutoPossessAI
#include "GameFramework/Pawn.h"
Access: public
Specifiers: UPROPERTYEditAnywhere
Description
Controls when this pawn automatically spawns and is possessed by an AI controller. Set to PlacedInWorld or Spawned to have the engine manage AI controller lifetime without manual setup.
Caveats & Gotchas
- • Requires AIControllerClass to be set — if AIControllerClass is null this property is ignored and no AI controller is created.
- • AutoPossessAI is silently ignored when AutoPossessPlayer is set to anything other than Disabled, so if a pawn is accidentally set to auto-possess both a player and AI, the AI controller is never spawned.
Signature
EAutoPossessAI AutoPossessAI Example
Configure an NPC to auto-spawn its AI controller C++
AMyNPC::AMyNPC()
{
AIControllerClass = AMyAIController::StaticClass();
AutoPossessAI = EAutoPossessAI::PlacedInWorldOrSpawned;
} Tags
Version History
Introduced in: 4.7
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?