Spawn Default Controller and Auto Possess AI¶
At a glance
Lives in: Blueprint API / Pawn - Target: a Pawn or Character -
Returns: no value in Blueprint - Fails by: leaving the pawn without
a controller; there is no failure pin - Official docs:
Spawn Default Controller,
EAutoPossessAI,
AI Controllers,
and Possess
The one-minute version¶
Spawn Default Controllerasks a pawn to create its configured default controller, then have that controller possess the pawn.- In Blueprint, the node does not return the new controller. Call
Get Controllerafter it, then cast or validate the result. Auto Possess AIis the editor/class setting that decides whether Unreal should do this automatically for placed pawns, spawned pawns, both, or neither.- The pawn still needs an
AIController Class. No controller class means there is nothing useful to spawn. - AI possession is authority work. In multiplayer, the server should create and possess AI; clients observe the replicated result.
- The node does not start your Behavior Tree, build a NavMesh, fix movement, or prove the controller is the class you expected.
What it actually does¶
An enemy pawn has a body and a brain:
flowchart LR
Pawn[Enemy Pawn or Character] -- AIController Class --> Class[BP_EnemyAIController class]
Class -- Spawn Default Controller --> AIC[BP_EnemyAIController instance]
AIC -- Possess --> Pawn
Spawn Default Controller is a pawn-side helper for the common case "this pawn
should be controlled by its default AIController class."
pseudocode of the engine behavior - not engine source
function Pawn.SpawnDefaultController():
if this pawn already has a controller:
return
if this machine should not authoritatively spawn the controller:
return
ControllerClass = Pawn.AIControllerClass
if ControllerClass is None:
return
NewController = spawn ControllerClass near the pawn
NewController.Possess(Pawn)
Blueprint hides the returned controller. That is why the practical follow-up is always:
Spawn Default Controller
-> Get Controller
-> Is Valid
-> Cast To BP_EnemyAIController
The broader control link is covered in Possess / Un Possess / Get Controller.
Auto Possess AI¶
Auto Possess AI is a pawn class/instance setting. Its values answer when the
engine should attempt the default-controller spawn for you:
| Setting | Beginner translation |
|---|---|
| Disabled | Never auto-create an AIController. You will call Spawn Default Controller yourself, or the pawn will stay uncontrolled. |
| Placed In World | Auto-possess pawns already placed in the level. Useful for enemies hand-placed in a map. |
| Spawned | Auto-possess pawns created during play. Useful for wave spawners. |
| Placed In World or Spawned | Try for both placed and runtime-created pawns. |
For a first enemy, the usual setup is:
BP_EnemyCharacter
-> AIController Class = BP_EnemyAIController
-> Auto Possess AI = Placed In World or Spawned
If you spawn enemies yourself and need to configure data before AI starts, a manual pattern can be cleaner:
Spawn Actor BP_EnemyCharacter
-> set team / patrol route / target data
-> Spawn Default Controller
-> Get Controller
-> Cast To BP_EnemyAIController
-> Run Behavior Tree
When it fails (and what failure does)¶
The failure symptom is simple: Get Controller is still None, or it is not
the controller class you expected.
Common causes:
- No AIController Class is set. The pawn has no default controller class to instantiate.
- Auto Possess AI does not match how the pawn was made. A spawned pawn
with
Placed In Worldwill not auto-possess. A placed pawn withSpawnedwill not auto-possess. - The pawn already has a controller. The helper is for filling an empty control slot, not replacing an existing brain.
- The call runs on a client. Client-side AI controller creation does not establish the authoritative possession link.
- The pawn is invalid, pending destruction, or not in a playable world. Construction/editor contexts are not normal AI startup.
- Movement debugging is pointing at the wrong layer. The controller may
exist while
AI Move Tostill fails because there is no NavMesh, the pawn lacks a movement component, or the Behavior Tree never started.
There is no failure pin, no retry, and no guaranteed project-facing log. Print
the pawn name, net mode, Has Authority, controller class, and Get Controller
result before changing Behavior Tree logic.
The pattern everyone actually uses¶
For hand-placed enemies:
BP_EnemyCharacter defaults
-> AIController Class = BP_EnemyAIController
-> Auto Possess AI = Placed In World or Spawned
BP_EnemyAIController BeginPlay / OnPossess
-> Run Behavior Tree
-> initialize Blackboard keys
For a spawner that needs setup first:
WaveManager on server
-> Spawn Actor BP_EnemyCharacter
-> set SpawnRoute / TeamId / InitialTarget
-> Spawn Default Controller
-> Get Controller
-> Cast To BP_EnemyAIController
-> StartEnemyAI(SpawnRoute, InitialTarget)
The C++ twin, for the curious (our own example code):
void AEnemySpawner::FinishEnemySetup(AEnemyCharacter* Enemy)
{
if (!HasAuthority() || !IsValid(Enemy))
{
return;
}
Enemy->SpawnDefaultController();
AEnemyAIController* Controller =
Cast<AEnemyAIController>(Enemy->GetController());
if (IsValid(Controller))
{
Controller->StartEnemyAI();
}
}
Lookalikes - which one do I want?¶
| Node or setting | Changes / returns | Use when |
|---|---|---|
| Auto Possess AI | Class/instance setting | The pawn should get its AIController automatically when placed or spawned. |
| Spawn Default Controller | Creates and possesses with the default AIController; no Blueprint return | You need to create the AIController manually after setup. |
| Possess | A specific controller takes over a specific pawn | You already have the controller instance and are deliberately changing control. |
| Get Controller | Current controller, or None |
You need to prove the pawn has a brain before debugging AI. |
| Run Behavior Tree | Starts a Behavior Tree on an AIController | The AIController already exists and should begin tree logic. |
| AI Move To | Sends a movement request | The pawn is controlled and needs to move through NavMesh. |
| Set Owner | Changes actor network owner | You are fixing RPC/owner-only networking, not AI control. |
Rule of thumb: Auto Possess AI and Spawn Default Controller create the brain; Run Behavior Tree tells the brain what decision tree to use; AI Move To asks that brain to move the body.
Going deeper¶
- Possession - controller vs pawn, player vs AI control, and why a pawn can be unpossessed.
- Possess / Un Possess / Get Controller
- the controller-to-pawn link this page relies on.
- AI Move To & the NavMesh - movement failures after the controller exists.
- Run Behavior Tree, AIController Setup, and Blackboard Keys
- starting decision logic from the AIController.
- Simple Patrol, Chase, Attack, and AI Debugging
- a complete first-enemy loop.
- Official docs: Spawn Default Controller, EAutoPossessAI, and Controllers.
- Engine source (requires engine access - we do not reproduce it here):
APawn::SpawnDefaultController,APawn::PostInitializeComponents,APawn::PossessedBy, andAPawn::GetControllerinEngine/Source/Runtime/Engine/Private/Pawn.cpp;EAutoPossessAIinEngine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h.