How can I change Local Player Class?

Hello! I’m made a custom class derived from the ULocalPlayer so I can override the CalcSceneView and perform a camera cut but I have no idea how tochange the class of the local player. I tried casting the local player from the player controller but it returns null.

Interesting problem. Have you tried changing the default local player class in Engine.h (LocalPlayerClass).

This variable is then used in UGameInstance -> CreateLocalPlayer(int32 ControllerId, FString& OutError, bool bSpawnPlayerController);

This is then used as a local player in the game.

Hope this helps!

in “Edit” > “Project Settings” Search for “LocalPlayer”. There you can set the default Local Player Class

2 Likes