How to Spawn an AI Controller Pawn in Unreal Engine

Use “Spawn AI From Class” to Spawn an AI Character

If you want to spawn a Non-Player Character (NPC), you should use the “Spawn AI From Class” node in Unreal Engine, rather than “Spawn Actor for Class”. This is because an AI character is actually composed of two actors: the pawn and the controller (which is another Actor), and “Spawn Actor for Class” only spawns the “Pawn” actor and not the related controller.

Using “Spawn AI From Class”, you have the option to specify the Behavior Tree to use for the AI character, although this is not always necessary if the controller handles the AI behavior itself.

If the “No Collision Fail” checkbox is checked, the NPC will be spawned regardless of whether there is a collision in the designated location or not. However, if it is unchecked, the game engine will attempt to adjust the NPC’s location to avoid collisions. If the location cannot be adjusted to avoid a collision, the NPC will not be spawned.

Using “Spawn Actor for Class” and “Spawn Default Controller”

If you choose to use “Spawn Actor for Class” to spawn your AI character, your character will spawn but will not move, as it will not be possessed by a controller. In that case you can use “Spawn Default controller”.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *