Why 'get Game State' is not valid on client?


I use ‘Get Game State’ node in My GameInstance, but it’s not working on client.

Why it always fails on client?

I thouth GameState exist on server and replicates to all clients, so client can get information from GameState.

If im correct game state exist on all clients and server… have you tried to cast it to your custom GS before checking validity?

Is the gamestate your casting to the default gamestate in the game mode? Also I’ve encountered a bug where it didn’t take gamestate change until restarting the editor

i found solution, but i still don’t understand how it work.

it works with delay

Where it’s calling game state is likely happening before gamestate is initialized

In GameInstance.

i think i found solution.

i found post where is said that this is the order in which ue4 create classes.

Player Controller -> HUD -> Game Mode -> Game State -> Player State ->Level

So i just relocate my functions to playerState and it works without delays

I have a similar issue. I load my game screen in BeginPlay of the level. In the EventConstruct of my game screen BP I make a call to GetGameState and cast it to my custom implementation. The cast is successful but in the next frame when I call to set a variable in the custom GameState my game crashes. If GameState is supposed to be ready before the level is ready shouldn’t my approach work? Or am I missing something?