Trying to recreate 3rd Person Character...

Hi all, newbie here. I’ve created a new C++ project based on third person example. I’m trying to recreate the third person C++ class they already have in there. I have done so, but when I press “Play” (both the class I created and the example character have disabled auto possess), the engine drops a new instance of the example character in the world at the player start location. What code is driving this? I understand it’s sort of a failsafe for if no character has auto possession enabled, but I can’t find how to turn that off. Just want to understand ALL the code in play here, not just what I can see. Where would I find it? Thanks in advance.

Change Default Pawn Class in GameMode. BP or C++.

If you are starting with an empty C++ project, in the editor content browser, “add new C++ class” for the following:

  • create a custom GameMode
  • create a custom Character
  • create a custom PlayerController
  • create a custom HUD

Suggest the only thing these classes initially contain is logging their constructor / destructor and BeginPlay() to insure they work.

Then in your GameMode set the custom pawn, player controller, and HUD as follows:

* Main menu game mode.
* Set default mode for the map - World Settings >> GameMode >> GameModeOverride
* Set default mode for the project - Edit >> Project Settings >> Maps & Modes >> Default GameMode
AGameMode_MainMenu::AGameMode_MainMenu(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 LOG("CTOR : AGameMode_MainMenu");

 // set default pawn, player controller, and HUD
 // these can be read-only viewed in the editor:
 // Edit >> Project Settings >> Maps & Modes >> Default Modes
 DefaultPawnClass = ACharacter_MainMenu::StaticClass();
 PlayerControllerClass = APlayerController_MainMenu::StaticClass();
 HUDClass = AHUD_MainMenu::StaticClass();

Then create a new Map and in “Settings >> World Settings” change the map GameMode to your custom game mode.

Finally, play the map and look at the log to see all your custom objects are there (also helps you to learn order of construction / destruction). Grats you created a 100% custom game. :wink: