Download

Custom Player Controller

If I understood correctly, in APawn I can set AIControllerClass, is there a similar thing I can do for a Player controller?

Yes all controllers can possess any pawn :slight_smile:

Yeah I’m aware of the possess function, but I mean a default controller class which the Pawn initializes with. (e.g. changing the default controller of the player you play with when the game starts)

PlayerController spawns when new player connects to server (in case of local game it will be one), you can set default PlayerController here

Edit -> Project Settings -> Global Settings -> Default Classes

It says in Default Classes -> Local Player Class: “LocalPlayer”, while the class it uses is “APlayerController”.

Are you sure it’s the right place? Maybe my conclusions about the classes actually being used are wrong?

Maybe it’s related to DefaultEngine.ini? Something like that just for the player controller:

+ActiveClassRedirects=(OldClassName=“TP_ThirdPersonCharacter”,NewClassName=“TestCharacter”)

YourGameMode.cpp


#include "YourPlayerController.h"

PlayerControllerClass = AYourPlayerController::StaticClass();

Yup thanks, how did you get to that information?

It is same logic like in UE 3. So i just looked declaration of DefaultPawnClass and searched on the right place.

Did you need to download the source from github for that or did you search the headers in external dependencies?

I work with full source to see the logic better. But to find this PlayerControllerClass declaration normal dependencies are actually enough.

Okay thanks :slight_smile: