How to save client variables before joining session and load them back after joining session

Hello, everyone. I’m having problem with saving data of client (before joining session) and load the data back after joining session. I’ll explain what I exactly want to do.

(1) I’m writing a 2 player fighting game which has four heroes. Each player has to choose a hero first then will be loaded into a map.

(2) Server player chose the hero, hosts the game and loads into the map. Everything is ok.

(3) The client player has to choose the hero before joining the session. Then joins the session and loads into the map of server player.

(4) To store which hero is chosen by client, I stored the index of hero into a variable named P2Hero in myGameInstance blueprint.( This step occurs before joining the session )

(5) After joining the session, and onPostLogin event, I want to get back the saved P2Hero variable from client’s myGameInstance blueprint but I have no idea how to cast to myGameInstance of the client. I can only cast to the server’s myGameInstance.

(6) My main point is how to save datas of client before joining the session and how to load them back after joining the session.

Is it available to cast to the game instance of each client? If not, is there any other ways to do such thing? I’ve tried saving the variable in player controller and player State but they changed to default values after loading another map. I’ve asked a question about this in answer hub, one user tell me to do saveSlot but the game will be running on two separate mobile phone (server’s and client’s) so post login event of server can’t get the save file from client’s phone. So at last the saveSlot method doesn’t work.

Pls help me. I’m having a really big problem. Thanks.

Use save game. But it is major pita to debug/develop in editor, because everything saves to same location, so if you have multiple clients emulated in editor, each of them will overwrite others.

The client and server player are playing with different mobile phones. PostLogin event runs on server and server can’t read client phone’s save file. Is there a way to let server read client’s phone’s save file?