Custom Player Controllers and Game Modes

I created a custom player controller but I can’t set it. When I try to override the game mode or change the default in the project settings the selection is greyed out. Struggling to find much on the topic, especially recent information.

Do I still have to create game mode and controller blueprints or something? I thought I could just make the player controller script and assign it as the default.

Usually it works when you set up BP game Mode in your world and new Controller there.

So you’re saying it’s like characters, I still need to make a BP regardless?

Some BP Game mode is needed if you want to change anything like HUD, character, controller, states.

I got it to replace it but having crash problems now, will circle back when I can figure ■■■■ out.

Set your custom game mode settings in the constructor like this.

ASpectatorGameMode::ASpectatorGameMode(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	LOG("ASpectatorGameMode::ASpectatorGameMode()");

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

Work flow is generally:

  • create custom game mode class which sets the default pawn, player controller, hud, etc. classes in the header
  • on a per-map basis, you set the default game mode for the map in Map >> Settings >> World Settings >> Game Mode >> Game Mode Override
  • on a project-wide basis, you can change the default game mode in Project >> Settings >> Maps and Modes >> Default Game Mode
1 Like

I wasn’t able to change those defaults though. That’s what I was saying. It was just greyed out until I changed Game Mode Override or Default Game Mode to a custom BP.

I thought I would be able to do it without creating the BP and just having the scripts.

Making the BP isn’t a big deal just feels like an unnecessary extra step - which as someone coming from years in Unity is kinda what a lot of Unreal feels like (though there’s plenty of positives too tbf).

Ahh ok I see what you mean.

Yeah. Honestly a lot of my problems come from, “This feels like it should be cleaner/less steps than it appears to need.” And I’d rather look like an idiot, ask and learn than just make something that feels off work and still not understand it.

If a game mode BP is absolutely necessary though then it is what it is and now I know.