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.
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
:
- In the Content Browser, click the
+ Add
button, then selectBlueprint Class from the menu
. Alternatively, right-click inside the Content Browser and chooseBlueprint Class
from the context menu.
- A dialog will appear asking you to choose a parent class. Click on the
ALL CLASSES
section to expand the list of available classes.
- In the expanded
ALL CLASSES
section, start typingSGPlayerController
in the Search box. WhenSGPlayerController
appears, select it and click theSelect
button to create your new Blueprint class based on it.
- 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 pressingF2
or by right-clicking on it and selectingRename
from the context menu.
- Once you have renamed the
NewBlueprint
class to your desired name, click onSave All
to save the new class to disk.
- Finally, set your newly created subclass of
SGPlayerController
as the defaultPlayer Controller Class
. Depening on the Unreal Engine version and your project's type and configuration, you might be able do this by navigating toProject 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 yourDefault GameMode
and setting the defaultPlayer Controller Class
directly from there. Once set, click on theCompile
button and save your game mode Blueprint asset.