How to subclass and then use UGameEngine?

#Compile Error?

What is the compile error?

Make sure you are using

#include “Engine.h”

instead of #include “EngineMinimal.h”

in YourGame.h

Rama

Hey guys,

So joeGraf suggested in my thread here that I subclass the game engine and then tell UE4 to load my version instead. I tried this, in my DefaultEngine.ini, where my project is called FlightPrototype;

[/Script/Engine.Engine]
GameEngine=/Script/FlightPrototype.UFlightGameEngine

I also tried the above without the ‘U’ at the front of the class name. This was with my UFlightGameEngine class inheriting from UGameEngine.

Any ideas?

Thanks.

No compile error. It just doesn’t use my version of UGameEngine in my game. Think it’s something in the .ini. My module name is the same as my project name, right?

Did you ever get this working? I would like a solution.

Hi

I am very interested by this feature too

Di you mange to make it work ?

Did anyone figure out how to subclass and make it work?

Finally figured this out! In a project titled ‘NetworkingDemo’, with a UGameEngine subclass ‘UNetworkedGameEngine’, I added the following to my DefaultEngine.ini file:

[/Script/Engine.Engine]

GameEngine=/Script/NetworkingDemo.NetworkedGameEngine

It seems that you need to drop the preceeding ‘U’ from the class name. You can see this + other options for setting default classes in the BaseEngine.ini file in your Engine/Config/ folder.

Not working for me either. The class compiles and the engine knows about it because it creates one when I fire up the editor but the game doesn’t seem to use it.

Well - looks like that’s standalone only and there is a different approach for playing from editor. I’ll add my voice to the “kinda annoying would be nice to have a single approach to this in both” list, but going to try this now.

This doesn’t work quite the same - Init and PreExit are called with regards to the lifetime of the editor rather than the game. It does look like there are callbacks that give you equivalent functionality though (look for PlayInEditor).

The one caveat to get it to compile was to add #include “UnrealEd.h” in my .h file.