How to use Player State, Game Mode and Game Instance correctly to replicate a variable?

Hi everyone, as the title says , I am stuck with the correct replication of a simple variable over the session.
To be more specific , I’m trying to use the GI to creare and store a Player Name on Event Init, than I want to set another variable on my Player State using the function “Get Game Instance” on PS Begin Play.
I created a simple Host/Join session without a dedicated server (Up to 3 player in total), and I have a EventOnPostLogin on my GM that collects Player controller and their Player States.
When I try to print all the names from my PS array, I only get 3 times the name of the server.

I tried searching online, but everyone speaks about the GI as a independent body, that only exist on Client , so why the one that host the session, replicates it’s name on all others?

Game instance is not replicated, each client has it’s own.
Game Mode only lives on the server, nor in any client. (No client can access it)

This post explain it a little bit so it might help you better:


The documentation is really good for these kind if things.

1 Like

Yeah, I checked the ue docs , but they just tell me which class I need to use, but not how to properly use them.
In theory I understand everything, in practice I’m having problems.

Thank you, I will study the pdf, it would seem great to understand the functions and methods to use

I came to a conclusion, If I have a non-dedicated server, I can’t pass my variable directly from Game Instance in match, because the Server Game Instance will interfere.

Somehow I managed to get it to work using the Save Game to get my variable and the GI to save save them.

Thanks for the help!

Would get rid of the Delay node OnPostLogin as when 2 player try to connect at the same time within that 0.5 seconds you will miss that players (or both) OnPostLogin event.

Can you show us what you’ve done?