Casting to gameinstance fails

I have a variable in my gameinstance that I want a separate blueprint to default its variable value to it, but when I cast to the gameinstance in the blueprints construction script it fails every time. It works perfectly fine if I have it in my player construction script, but not my other blueprint.

As far as I have understood: The construction script is only executed when you create a new instance in the unreal editor, but never in the game. I guess the other blueprints are not instantiated at this moment in the editor and this is why it fails. Can you check if ‘Get Game Instance’ returns a NULL-value in the construction script?

Maybe the ‘Event BeginPlay’ int he event graph is what you are looking for.

It returns null when in the blueprints construction script, but not the players. I dont understand why this happens at all.

Construction script is just for setup actor depending on surrounding, it usally only use for editor perpaces. All startup code should be in BeginPlay

Exactly - ‘Game Instance’ is != null only when the game is instantiated.
As long as you are in the editor, there is no game.

Use the ‘Event BeginPlay’ in the Event Graph. This is the right place for your code.