Global variables not saving between play sessions

CJWorkshop 2 weeks ago in Game Creator updated 5 days ago 12


I have started testing the load and save feature in game creator, but for some reason my global variables will not save. I have ticked the save box next to them, but their data does not stay the same between play sessions. 

I have set my game up, so that when a player moves over a checkpoint the game saves to the current profile (profile 0). After building and running the game as a standalone file, i am able to move between scenes and the global variables do save. The issue comes when i shut down the build and start it again. After loading the saved profile (profile 0), the global variables do not load with it. 

Any help with this would be greatly appreciated it. I'm not sure what i'm doing wrong. 

Unity version:
Game Creator version:

Hey, I use the save and load variables successfully in a production game. Hence I know that it works. Firstly, which versions of Unity and GC are you running? And on what platform/device are you running on when it doesn't load/save?

The things I would look for are any Actions that are clearing the variables on or before quit, any save Actions that are not where they should be, or something that is changing the profile number.

When you load the game, are you loading from the profile number or last saved game (I would try both to see if there is a difference).  

Unity Version - 2019.4.10f1

Windows - Windows 10 64 bit

Game Creator - GC 1.1.8

I created a new scene with 3 new buttons to test the saving and loading of the global variables.

This scene is placed at the start of the game. The saving and loading of global variables works perfectly. So my instant thought was that something was resetting the global variables when i enter my main level. To test this, i created a new global variable (Screw Score New) and replaced it with the old one, however, i still get the same the results. It seems to me that the global variables just do not load when i go into a new scene.

I think I might have a similar or related issue.

Basically Saving and Loading works, but the global variables have a "quirk".
I'm using a global variable string to name the save slots with the time of saving.

For example:

When it's empty it just says "Slot 1".
When I save in it, it changes to "2020-09-14 10:01"

My problem is that when I later save in "Slot 2", changing it to say "2020-09-14 10:05"
And I then load Slot 1, slot too appears to be empty as the global variable string reverts back to "Slot 2" as it was when I saved Slot 1.

Is there a way around this?
Please let me know if this is actually unrelated, I didn't intend to highjack the thread.

Hmm not sure if it is related, i'm only using the default slot (Slot 0) for saving and loading. Does yours work if you only use slot 0? 

So, I did some further testing, and I couldn't reproduce the same problem you had.

I was able to save and load and the global string variable loads / updates after loading the slot.

Please note that I never use "current profile", I always select the profile, starting with 1.
Like Pivec mentioned, I'd try using the action with a selected profile, and maybe a different one than 0.

Ah ok, must be different issues then.

I just tried saving everything to profile 1 and then loading from it, but unfortunately, it still didn't work.

Firstly, I would update to GC 1.1.9.

"It seems to me that the global variables just do not load when i go into a new scene." Global Variable are "Global". They are not loaded as such on a new scene, they are still there (well, at least should be). If you can send me a test project, I can see if I can reproduce or debug your issue. DM me on Discord.

I updated to 1.1.9, but still no luck. I reverted back after because it messed up some of my characters animations. 

It's odd because load last save game and load game does actually load the players last position. It's just the global variables which don't save. 

I have downloaded another asset from the asset store which saves objects position, rotation etc. Could this be interfering with the global variables? Here is the link to the asset - https://assetstore.unity.com/packages/tools/utilities/component-save-system-159191

Cool thanks. What is your discord? This is my first game, so it may be hard to know what's going on with the coding, although i have tried to keep it all neat lol 

I don't this this asset, but it may very well be conflicting with the GC save/load. You would need to do a test by duplicating you project and deleting that asset.

I don't have a Discord channel, but I am on the Game Creator channel every day with the same handle.


I have just found out something. The first time i start the game and click new game, the global variables will not save during that play session and will not appear how they should when i load the game back up again for the first time from desktop, 


when i load the game once more again from desktop, everything saves as it should do. Does anyone have any reason for this? It seems so strange. 

I have determined where the issue lies. It's when i press new game. For some reason, global variables will not save to it, but the characters position does save. Here is how i have set up my new game button. What part of the code is wrong? (i have added wait times to make sure each action is performed before the level is loaded)

I figured it out. I had to dance between profiles, whilst one was being deleted. (To begin with, i am on profile 0) Here is the code in case anyone else needs help.