GameMode construction script bug

Hi,
Below is a very simple node graph inside construction script of a game mode blueprint.
In select node there are 5 cars.
I’m just telling game to set last car as default pawn for this game.
Now here is bug:
This works in editor, in play mode, but it does not work on mac build.
Anybody knows a workaround ?
Thank you.

Forgot to mention I am using mac version 4.5.1 of editor.

Hey Titirez5,

Which version of editor are you using? There is a bug in 4.5.1 (UE-5465) that is causing Construction Script in GameModes to not execute, so I guess you’re using an earlier version?

In either case, a safer way of doing this would be to use a SpectatorPawn as Default Pawn Class, and then spawn and possess pawn on Begin Play.

Hi ,
I am using 4.5.1.
I will use your suggestion with SpectatorPawn.
Thank you.

Happy to help. I will let you know when I see any updates on that bug.

You mentioned that this was working when you played in Editor, but I’m not sure how. Was your GameMode already set with last car type as its Default Pawn Class? When I tried this same setup, it always returned value set in GameMode defaults.

Hm. So when you set this value via your Menu, you then opened a new level with same GameMode? If so, did you pass new level any commands?

value of “index” pin from “Select” node was something player selected from a menu, I just used 4 here for simplicity. And yes, while in editor play mode, this logic was working.
In GameMode defaults, first car was set as default pawn. This was useful for when I wanted to skip menu scene. But it always changed (in editor play mode) when I selected something else from menu.
I’m not sure either. :slight_smile:

I open a new level with a different GameMode. No commands, “index” parameter is passed using a “Save game to slot” node.

Interesting. I’ll keep digging into issue, and let you know what we find. Thanks for extra info!

user Eros has made a similiar question about Construction Script bug, but he has noticed that Construction Script of GameMode is correctly executed when play in “Mobile Preview” or “Standalone Game”.

This drove me crazy for a few days following a tutorial made in version 4.4 hehehe.
Thanks!

I got same problem in 4.6.1. I don’t know what should I do.

Hi Henry,

This bug is still being investigated, so for now it would be safer to let game spawn your default pawn class and then possess desired pawn at Begin Play. If you use Spectator Pawn as your default pawn class, you won’t need to worry about spawning a visible pawn before possessing new pawn.

I don’t know if this is related but I’ve just ported my project from Win64 to iOS and while it launches fine on MAC it seems to run wrong game mode ( default one) on iPhone.

That sounds unrelated to me. Please open a new post with as many details as you can give us and we’ll look into it. Thanks!

It was unrelated, and untrue, now I enabled breakpoints I see my code is running but my data isn’t loading, as it’s loose data in content directory my guess is I need to make sure it is explicitly packaged somewhere. On-wards and upwards along learning curve!