Setting Gamemode in C++

Hey!
I am pretty new to UE4 and coding (although not a total newb)
I want to set up a custom PlayerController in my Gamemode, which is a C++ Gamemode, and not BP.
But as there is no documentation at all on this (almighty google didn’t find any) I now have to ask here how to set it up.

I already found “DefaultPawnClass” “HUDClass” and “PlayerControllerClass” through the **** slow intellisens

But how do I set them up?
I put a constructor in my source file and included “MyController.h” and tried “PlayerControllerClass = AMyController;” (inside the constructor ofc) -> illegal, type name not allowed

looks like this:


#include "MyGame.h"
#include "MyGameMode.h"
#include "MyController.h"


AMyGameMode::AMyGameMode(const class FObjectInitializer&ObjectInitializer)
	: Super(ObjectInitializer)
{
	PlayerControllerClass = AMyController;
}

UCLASSes automatically create a StaticClass function to access their class type:


AMyGameMode::AMyGameMode(const class FObjectInitializer&ObjectInitializer)
	: Super(ObjectInitializer)
{
	PlayerControllerClass = AMyController::StaticClass();
}

Thank you so much! :slight_smile: