Download

A little issue I'm having with saving / loading the game

Hello, I’m having a little issue with the save game system that I’ve been working on. I am using the tutorial found here: https://docs.unrealengine.com/en-US/…ame/index.html

What I have is 3 files

  1. Widget which accesses game instance whenever, so if a game setting is changed, it will go to “change x setting function” in GameInstance_IN
  2. GameInstance_IN is where I save the global variables and the like. It has a “Check save exists”, “Create save game”, “Load save game” functions. It also contains a function to save the new framerate from the widget (1).
  3. SaveGameLocal blueprint file contains variables I wish to save.

Issues

  1. Whenever I print the save file it shows saveGameLocal_C## (# = new incremental number) Is this a new save file?
  2. Whenever I try to save new changes (GameInstance_IN) it says Accessed None to the FramesCounter variable.

I don’t have this issue if I use a player controller but for some reason I can’t seem to cast the data from inside GameInstance_IN to SaveGameLocal

NOTE:
In the screenshot provided during the forloop it says First index: 0 and Last index: 1. I meant to keep it as 0 before taking the screenshots.

Does GameInstance not work like I think it should? o.O

Thank you for your time!


One thing I see, your “Load Save Game” and “Create Save Game” events need to be setting the “SaveGameReference” in your game instance otherwise that reference is blank.

Dang, I had to take a few months break from my project and the rust showed from this mistake. That was an easy correction! Thank you so much! Now The question that remains though, is when I load the game using

CastTo SaveGameLocal > (Out Pin) > Function Get Display Name > Print String

It returns SaveGameLocal_C0

Then I restart the game and it shows
SaveGameLocal_C1

Then again…
SaveGameLocal_C2 etc…

Is this normal? The number resets when I exit out of the UE editor and open it again. I can’t find details about this in the documentations. In my mind the slots are like say in a Final Fantasy game you have Slot 001, Slot 002, Slot 003. Or am I misunderstanding?

Haha, glad it was an easy fix!

As for the name changing, I don’t think it’s something to be worried about. I can’t be for sure, but since you’re referencing the variable and not the actual disk save-game, I think it’s just the engine creating multiple versions and not cleaning them up until shutdown.

This happens to me when open utility widgets multiple times. There will be references to the object in the debug filter, but its not actually there. I could be 100% wrong on what the actual cause is (I likely am cus I don’t know enough) but again, pretty sure it’s nothing to be concerned about.

What you’re referencing isn’t what’s on the hard-drive, just a temporary object that allows you to make changes in-game and save them at will.

Also, yes. This is how it works :slight_smile: Each slot also allows for multiple “names”. I think this might be used for multi-player saving (not necessarily networked), but not sure.

Thanks a lot for your help! If Epic had proper documentations you wouldn’t have been able to show off how awesome you are haha :slight_smile: