Default values from game instance are zero/null

I have a struct called S_BaseStats which is then added to my game instance as a variable.

The variable has default values set.

Once starting the game and getting the game instance, the variable and the struct values within are all zero and don’t return the default values that were set.

Am I missing something with how the game instance works? Should I be setting the default values somewhere else?

I assume you also specified your GI in the project settings.

I think it’s a UE5 bug.

I did yes. The cast is also working fine so it is using the correct game instance

1 Like

Hi

I have the same issue, VS indicate that the Game Instance class is null, therefore all struct variables remain uninitialized.

Regards

It’s strange, because the GI works for me in 5.

Not sure if you tried this, but you can override ‘Init()’ inside your game instance. ‘Init()’ gets called as soon as your game instance is initialized. Inside the override function you can set member variables in your struct.

image

Hopefully this helps…

1 Like