Custom UGameEngine functions not being called?

I’m trying to setup a custom UGameEngine but my Init() function is not getting called?(no break points are being hit) so i started up the shooter example and much to my surprise, I’m getting the same results. I have an object that needs to be persistent throughout the entirety of the game and the entirety of the game depends on it. I need to call a function from the gamemode because I need to know if it’s a server. I started with using game instance and setting the dedicated server to start on a certain map with a gamemode that handles setup and then load a map to handle lobby stuff. The issue with this is that apparently when using the PIE both the server and client start on the currently selected map. So this wont work. But if I was able to use and debug a custom UGameEngine, that would be great! But from what I can tell. it’s not working.

It’s literally driving me crazy that I can’t do what would normally be a relatively simple thing. I guess if I can’t get any help here, I’m going to have to resort to customizing the UE4 source. Which i don’t want to do because it takes so long to compile. I’m also getting discouraged by the massive lack of documentation. I’ve spent over a week trying to do this and so far, no solution that I have been able to come up with will work because of the lack of control that I have.

Any help is much appreciated.

Not related to your question but if you want to run server and client not at the same time, make a .bat file in your project folder and add this ( [ and ] not included )

ForDedicatedServer: “[EditorPath].exe” [YourProjectNamePath].uproject [MapName]?game=[GameMode] -server -log

ForClient: “[EditorPath].exe” [YourProjectNamePath].uproject [ServerIP] -game

for the [GameMode] mine is something like /Script/ShooterGame.ShooterGame_FreeForAll and the ServerIP will be 127.0.0.1 if you want to test on same computer.

You can run server first let it finish initialize then run the client, you can do independent debug on each.

Thanks! I’ll play with that tomorrow. I really wish it were possible to debug the server and client separately. I’ll probably look into what I can about that in the morning.

Oh really?! Thank you very much for the info! I’ll definitely be working with this tomorrow!

Yes, it will debug separately just put -log in client too if you want to debug client, we use this all the time for our multiplayer game to run dedicated server without build from source code, but if you call UMG in any default class of GameMode like Controller or Pawn then the dedicated server might not gonna work, this bug is gonna be fixed in 4.7.

Did you ever figure out how the custom UGameEngine is being attached in order to debug it?

Hi, I was trying to do something similar. I also need a custom UGameEngine class. One thing you need to do is to set in DefaultEngine.ini:

[/Script/Engine.Engine]
GameEngine=/Script/YourGame.YourCustomEngineClass

But it will work only in game, but not in the editor! To have custom Engine in editor you must create custom class from UUnrealEdEngine and set

[/Script/Engine.Engine]
EditorEngine=/Script/UnrealEd.EditorEngine
UnrealEdEngine=/Script/YourGame.YourCustomEditorEngineClass

And now we have two the same classes one for game and one for engine… Kinda annoying, isn’t there any way to make a super engine class for this?