Setting Up SGPlayerController

Depening on the Unreal Engine version and your project's type and configuration, you might be able to set SGPlayerController as the default Player Controller Class by navigating to Project Settings > Project > Maps & Modes > Default Modes > Selected GameMode > Player Controller Class. However, regardless of the engine version or project type and configuration, you can always configure this by opening your Default GameMode and setting the default Player Controller Class directly from there. Once set, click on the Compile button and save your game mode Blueprint asset.

Setting Up SGPlayerController - Setting the default class SGGameModeBase

tip

For greater control and customization, consider extending the SGPlayerController.

caution

Setting SGPlayerController or a subclass of it as the default Player Controller Class without setting SGPawn or a subclass of it as the Default Pawn Class will cause your simulation or editor to crash. So, it's a strict requirement.

Extending SGPlayerController

Follow these steps to extend and set up your own version of SGPlayerController:

  1. In the Content Browser, click the + Add button, then select Blueprint Class from the menu. Alternatively, right-click inside the Content Browser and choose Blueprint Class from the context menu.

Extending SGPlayerController - Adding a Blueprint Class

  1. A dialog will appear asking you to choose a parent class. Click on the ALL CLASSES section to expand the list of available classes.

Extending SGPlayerController - Picking a Parent Class

  1. In the expanded ALL CLASSES section, start typing SGPlayerController in the Search box. When SGPlayerController appears, select it and click the Select button to create your new Blueprint class based on it.

Extending SGPlayerController - Picking SGPlayerController as the Parent Class

  1. After returning to the Content Browser, the Unreal Editor will prompt you to rename NewBlueprint to your desired class name. You can rename the class at any time by pressing F2 or by right-clicking on it and selecting Rename from the context menu.

Extending SGPlayerController - Renaming NewBlueprint

  1. Once you have renamed the NewBlueprint class to your desired name, click on Save All to save the new class to disk.

Extending SGPlayerController - Renamed NewBlueprint to BP_SGPlayerController

  1. Finally, set your newly created subclass of SGPlayerController as the default Player Controller Class. Depening on the Unreal Engine version and your project's type and configuration, you might be able do this by navigating to Project Settings > Project > Maps & Modes > Default Modes > Selected GameMode > Player Controller Class. However, regardless of the engine version or project type and configuration, you can always configure this by opening your Default GameMode and setting the default Player Controller Class directly from there. Once set, click on the Compile button and save your game mode Blueprint asset.

Extending SGPlayerController - Setting the default class BP_SGGameMode