Create Custom engine classes for your game module

From Epic Wiki
Jump to: navigation, search



Creating, custom Engine classes is actually very easy, and there is not much work needed. Why would you want to create custom Engine class ? It's useful, when you need to initialize some data before game or editor will be loaded, during engine initialization, so that data will be accessible after game starts.

Adding Classes

To get started you will need to add two new classes to your project. Note the "U" prefix, which is required for any non-Actor UCLASS. An actor uses "A":

#include "Engine.h"
#include "YourGameEngine.generated.h"

class UYourGameEngine : public UGameEngine


#include "UnrealEd.h"
#include "YourGameEditorEngine.generated.h"

class UYourGameEditorEngine : public UUnrealEdEngine

Along with standard blank implementation in CPP files.

Add UnrealEd dependency

In your Build.cs file, you will find PublicDependencyModuleNames. Add UnrealEd in it, like this:

    new string[] { 

Edit DefaultEngine.ini

Now you need to edit DefaultEngine.ini in your project config folder. Open file and add these lines:


That is it! Now when you compile and run you project, new classes will be used.

If you're creating a custom editor engine, there are some more set-ups that need to be done to ensure a proper building of both game and editor. Refer to for it.

UE4 Answer Hub Related posts

Extending the editor engine

How to Include files from another module

Linking error when exporting component

How can I set up multiple modules so that they can interact? (theoretical explanation)