How to save the current session to then restore it?

Do you have the blueprints or code you are using?
I use a USaveGame class, and add data into that. I then set the data I want to save (For example, any session info), and call SaveGameToSlot and pass in the USaveGame class I created.


So I’ve been working on a multiplayer game. Right now I’m working on the player reconnecting after there’s a disconnect (for example the game crashed or something). I was trying to use blueprints to store the session to which the user connected so that afterwards if the player would restart the game he would be able rejoin the same session.
I am currently using the blueprint SaveGameToSlot and then the LoadGameFromSlot,however I get the error “Invalid session info on search result”, which led me to believe that what I’m actually saving is a pointer to the object which doesn’t exist anymore since the game was restarted.

That said is there a way to save the session using only blueprints? Or do I have to save it using cpp?

Thanks in advance :slight_smile:

That’s exactly what I’m doing. I created a SaveGame child blueprint that contains only the BlueprintSessionResult. I then proceed to store it and load it, which seems to be working fine using the SaveGameToSlot and LoadGameFromSlot. Only When I use the loaded session to connect to steam I get the error stating that “Invalid session info on search result”.

Found any solution?

For me looks like a Session Result Structure can’t be save at a ‘save game’.

you should not save any pointers. IMHO, what you need to save is a name of the user and all his relevant data, like inventory, scores, etc. You also need a method of identifying users, like a user name, for example. So when a user gets connected, from his player controller you can get his user name and restore data.

Actually, there is a much better way, unless it is somewhat a persistent world. Unreal has a PlayerState that is automatically saved once a client disconnects. When a player reconnects, its player state can be restored automatically and you can recover your inventory, health, kills, mana, etc. There is a very nice article about it:

1 Like

First of all thanks for the answer, however what I’m trying to do is not save the user information but actually save the server information, such as the server ip and other stuff so I can reconnect to the exact same server, since the client will connect previously to a random server.