Unreal Engine Session ID save and reload

Hello.

I searched the forum for a similar topic but couldn’t find a clear solution, only some ideas that didn’t help much. It’s about saving the session for the long-term memory of a Metahuman. I couldn’t find anywhere the option for session ID -1 or what exactly needs to be changed to be able to resume the same conversation with the avatar if I close and reopen the Unreal application.

Thank you, and I appreciate any response that can help me.

Hello @Florin_Danilov,

Welcome to the Convai Developer Forum!

How to Save and Load Session ID using SaveGame System – ConvaiBaseCharacter Blueprint

You can save and load the Session ID in Unreal Engine using the SaveGame system. Below is a detailed guide to implement this feature, including creating the BP_ConvaiSave SaveGame object. This solution has been entirely created within the ConvaiBaseCharacter Blueprint.


Step 1: Create the SaveGame Object (BP_ConvaiSave)

  1. Open the Content Browser:

    • In Unreal Engine, go to your Content Browser where you manage your project files.
  2. Create a New SaveGame Blueprint Class:

    • Right-click in the Content Browser and select:
      Blueprint Class → Search for SaveGame → Select SaveGame.
    • Name the new Blueprint something like BP_ConvaiSave.
  3. Add a SessionID Variable:

    • Open the BP_ConvaiSave Blueprint.
    • In the Variables panel, add a new variable:
      • Name: SessionID
      • Type: String
    • Compile and save the Blueprint.

The BP_ConvaiSave object is now ready to store the Session ID.


Step 2: Saving the Session ID

In the On Finished Talking event of the ConvaiBaseCharacter Blueprint, implement the following steps:

  1. Create Save Game Object:

    • Use the Create Save Game Object node and select BP_ConvaiSave as the class.
  2. Set Session ID:

    • Assign the Session ID from the Convai Chatbot to the SessionID variable of the SaveGame object.
  3. Save Game to Slot:

    • Use the Save Game to Slot node to save the SaveGame object. Set the slot name to "Session".
    • Add a Branch to check if the save operation was successful and print the result using a Print String node.

Step 3: Loading the Session ID

In the Begin Play event of the ConvaiBaseCharacter Blueprint, implement the following steps:

  1. Check if Save Exists:

    • Use the Does Save Game Exist node to check if there’s a save file in the "Session" slot.
  2. Load Save Game from Slot:

    • If a save exists, use the Load Game from Slot node to load the SaveGame object.
  3. Cast to BP_ConvaiSave:

    • Cast the loaded SaveGame object to BP_ConvaiSave to access the SessionID variable.
  4. Set Session ID:

    • Assign the loaded Session ID back to the Convai Chatbot.

Notes:

  • This implementation uses Unreal Engine’s SaveGame system to save and load Session ID data.
  • The primary goal is to Get the Session ID and Set it back later.

There are multiple ways to handle saving and loading depending on your requirements.
This guide focuses on the basic implementation within Unreal Engine’s Blueprint system. Any further extensions or customizations depend on your project’s needs. For additional help, you can explore Unreal Engine’s documentation and community tutorials.

Feel free to ask if you have any questions or need clarification! :blush:

wow…thanks for complete guide for this. I will check and came back asap.

best,
Florin

Hey. Thanks again for solution. I did everything like in description, yet for each session my avatar still starts from scratch. Maybe I missed something, I will try again later…

Florin

What do you see when you make a print string?

Successfully Saved ! . As in blueprints. Yet no session load I believe. I will still try later, step by step. Somebody maybe has a simple template project that works ? I will just change charID.

I recommend revisiting the Load step to ensure it’s configured correctly.

If possible, please share screenshots of your Save and Load Blueprints so we can review them and provide specific guidance.

Unfortunately, there isn’t a ready-made template project available, but we’ll do our best to assist you with your setup! :blush:

1 Like

Could you please consolidate your Load Blueprint into one complete view and share it without cropping any parts? Additionally, add a new pin to the Sequence node and use it, do not break the connection for Then 3.

then 3 was made from a new pin

It seems you’ve used the earlier Sequence, but that’s okay—it should still work. Let’s try the following steps:

  1. Add a Print String node to the False execution pin of the Branch node that follows the Does Game Save Exist check.
  2. Navigate to {Project Name}\Saved\SaveGames and check if there’s a file named Session.
  • If the file exists, could you share it with us for further analysis?

change extension to sav
Session - Copy.csv (1.8 KB)

Since the Session ID appears to be saved, we should focus on the Load part of the process.

  1. Delete the saved file to allow a new one to be created.
  • Navigate to the save file location and remove the current session file.
  1. Add Print String nodes to the False execution pins in your Load Blueprint to identify where the logic might be failing.

  2. After making these adjustments, run your project and share the Console Logs with me for further analysis.

log… [LOGS Removed for Security Reasons]

at the end session ID
is fine, was -1 in the beginning as I did some tests

Did you add a Print String to the False states as I mentioned above?
I removed the Log file because it contains your API Key.

ok with the log. Never knew has the key there. didn’t check :slight_smile:

I see …all the nodes…

Please follow these steps to debug your setup:

  1. Use the Sequence node located at the far-right side of your Begin Play event.
  2. Add a new pin, which should be Then 4.
  3. Insert Print String nodes as shown in the screenshot below to trace the flow of execution.
  4. Open the Output Log, right-click, and select Clear Log to start fresh.
  5. Run the game by clicking Play, then stop it.
  6. Share the Output Log with us for further analysis.

sent the log.

Later at home I will stay and take all again with the log to figure out

Thank you for sharing the logs via private message.

Upon reviewing them, I couldn’t find any logs related to the Load execution. It seems the load process might not be executing as expected. Could you please confirm if you included the specific logs I mentioned earlier?