GameMode Constructor

Hello !

I have a question

How can I declare a constructor for Gamemode? it has no even BeginPlay Event, so it is impossible do nothing in this class at the beggining of the game, I am sure in early versions of the engine there was a constructor for the gamemode, so, why is it gone?

thank you in advance !

Technically speaking AGameMode is an actor that only exist on the server and because it’s an actor it does have BeginPlay called on it. You just declare the constructor the same way you do on any actor.

AGameModeBase::AGameModeBase(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
//setup defaults

But you probably want to override some of the lifecycle methods such as InitGame as defined in the docs.