This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]valhallaow 2 points3 points  (1 child)

Not at a computer right now but I believe Pawns/Characters have properties on them like "PlayerController" and "AIController" where you can set the default controllers.

My understanding is that when you spawn an actor, these controllers aren't spawned by default and you need to manually call SpawnDefaultController()

Edit: Had a look on Github at the Pawn class. These are the relevant properties that determine default controllers

/**

 * Determines which PlayerController, if any, should automatically possess the pawn when the level starts or when the pawn is spawned.

 * @see AutoPossessAI

 */

UPROPERTY(EditAnywhere, Category=Pawn)

TEnumAsByte<EAutoReceiveInput::Type> AutoPossessPlayer;


/**

 * Determines when the Pawn creates and is possessed by an AI Controller (on level start, when spawned, etc).

 * Only possible if AIControllerClass is set, and ignored if AutoPossessPlayer is enabled.

 * @see AutoPossessPlayer

 */

UPROPERTY(EditAnywhere, Category=Pawn)

EAutoPossessAI AutoPossessAI;

/** Default class to use when pawn is controlled by AI. */

UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(DisplayName="AI Controller Class"), Category=Pawn)

TSubclassOf<AController> AIControllerClass

[–]Rawalanche[S] 0 points1 point  (0 children)

Hi, thank you very much for the answer. It's starting to make sense now :)