Game Mode Not Running in the Build (Development)

Hi guys,
I’ve a bunch of methods running in Game Mode blueprint. When I run in editor, everything works fine. Then I made a build of the project. Few things I did before building the game.

  • Go to project settings and in Map Mode option, I specified my game mode.
  • For all the levels, I specified this game mode in world settings of each level.
  • I made a development build.

Here is the problem: The game mode is not running in the build. I found it after putting debug messages in the game mode blueprint which can be easily seen in the development build.

Did anyone encounter this problem ? What could be the possible solution ? Why this weird behaviour happening ?

What could be the reason, for this game mode not running in Build.

Did you set Project Settings > Maps & Modes > Default Maps > Game Default Map?

Yes CleanCut I have set the Game Default Map option to my game title screen already. But game mode file is not getting executed.

I found a solution. Its a strange trick so Unreal veterans please have a look. I saw the code inside my game mode blue print I run some code in Contruction script. Here is the screenshot.

Add this is the debug message I get in running project from Editor (New Editor Window PIE)

Interestingly if I build(development build) the project. And run the standalone .exe file of the game I don’t see any of the debug messages in the build.
But if I run the same code in Event Begin Play of the game mode blueprint like below screenshot.

       **The only change I made is,  transfer piece of code from construction script to Event Begin Play.  This piece of code is running in build.**

Why Contruction Script is not running as the blueprint gets executed in the build ?

Fieol,

my understanding is that the construction script ONLY gets executed in the editor when you drag a blueprint into the level. Literally, it executes as you drag it into the level – to let you define logic to help alter the blueprint’s behavior depending on the objects around it in the level. So, if you spawn something in-game, the construction script is not run.

BeginPlay will run for all objects at the start of the level (if they already exist) or when they are first spawned in game.

Got the answer! Thanks CleanCut