Forum rules - please read before posting.

Saving - Can't seem to save a global variable

edited March 2022 in Technical Q&A

Unity Ver: 2019.4.35f1
AC Ver: 1.75.1

Hello,

Despite using AC for a few years, this is my first time touching saving, so you'll have to forgive me I'm at the very beginning of my learning!

Basically, when the player runs the game for the first time, I want to change a global variable which is then checked on any subsequent runs of the game. That sounded like a candidate for the save & load system.

However, the save doesn't seem to be capturing the change of variable.

Here's my action list setup:

It sets a global variable to true, and then performs the save.

However, if we look at the save data generated, it would suggest the global variable is false:

Have I fundamentally misunderstood how to save variables? Is there anything else that needs to be done to correctly save the state of them?

Comments

  • Looks like the right approach from the screenshots.

    If you enable Show realtime values? in the Variables Manager, is the variable showing as True there once the save has occured?

    Though this'll need to be addressed first, if you're looking to have this variable's value be persistent each time the game is run, you'll want to link it to Options Data so that its included in the Profile data rather than individual save-files.

  • edited March 2022

    The variable manager is showing the correct change to the variable. Here is the moment when the save occurs:

    Options data does indeed sound like the correct thing to use in this case. I'll have a read into how to use it.

  • I've switched to using options data in this particular case, and it's working great. I love AC!

  • edited March 2022

    Good to hear.

    I've also recreated the original issue, and will look into it further - thanks for the bug report.

  • Thankfully, it looks like this is an issue with the display of variable values in the Save-game File Manager, rather than the data stored in the save files themselves.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.