Project doesn't have GameModeBase

Hi All,

I’m completely new Unreal Engine and I’m following this guide: Setting up your Project in Unreal Engine | Unreal Engine 5.0 Documentation

I’ve reached the step of editing the files MyProjectGameModeBase.h and MyProjectGameModeBase.cpp. The tutorial says: ‘When you set up your Basic Code project in the previous step, Unreal Engine created a Game Mode for you. Game Modes define a game’s rules and win conditions.’

However my project did not come with either file and I can’t find any similar issues whilst trying to google why they’re not there.

I’d try creating a new GameModeBase file but all the guides say to create a blueprint version of it, not sure if that’s what I want as I’m not using blueprints?

Any help is appreciated.

You can create a new cpp file GameModeBase from your editor, set the appropriate variable from VS inside your .cpp and finally from your world setting in the editor set your game mode.

Thanks for the prompt reply.

Sorry but how do I do that? As I mentioned in my post the only tutorial I could find for that was creating a blueprint class (E.g. Setting Up a Game Mode in Unreal Engine | Unreal Engine 5.0 Documentation)

And what do you mean by appropriate variable?

Create New C++ Class menu option
Choose GameModeBase as its base class
Implement it in C++
Build and reload this class
Open up your World Settings (or Project Default settings) and configure the GameMode for the World (map) or Project to be your new class.

1 Like

MyProjectGameModeBase.h and MyProjectGameModeBase.cpp will only get automatically created if you created a C++ project. You probably made a Blueprint Project, that’s why they’re missing.

You can just manually add them. In the editor, on the top left, click Tools → Create new C++ class → select Game Mode as the parent class, name it and create. You can then set this game mode to be used either in Project SettingsMaps and Modes or in the World Settings of any Level.

2 Likes

Ok I feel pretty foolish, I didn’t realise you could scroll when selecting a base class :rofl:

That’s worked a treat! Thanks for both of your help.

I definitely made a C++ Project, I had to install VS for it. I also tried creating a few projects but no luck with any of them. So no clue what was going on with that.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.