We have a major bug in our saving system. Loading a save file loads entirely the wrong scene sometimes. Sometimes it loads the correct scene, but the wrong camera and replays the starting cutscene when it was already finished in the save file (this is the OnStart cutscene, not the OnLoad cutscene . Only some of the Adventure Creator variables seem to reset to their saved values when loading a save file in the same scene.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Share screenshots of your Settings Manager's "Save game settings" and "Character settings" panels. If you have this issue in the Editor, open up the Save-file Manager from the first panel and view the raw save-data for a typical save. Share screenshots and I'll take a look as well.
Of which type? Global, Local, or Component?
All global.
Forgot to mention we are also using Dialogue System and Steamworks. I've also got some unique Remember scripts.
Thank for the details. All scenes are listed in Unity's Build Settings, I take it.
In a backup/duplicate project, import the latest AC release, run the Auto-add Save components to GameObjects operation, and then test out newly-created saves once done.
If the issues remain, click Manage save-game files, select the save file that's causing the Street/Office scene and share screenshots of its data, together with your Build Settings window.
Is this independent of which scene is loaded, and are the problematic variables the same each time?
Thanks, I'll do this and let you know.
When I'm testing I'll make note of what variables are effected/not effected.
Unfortunately upgrading AC broke the project, we've got a lot of extensions to it now that are getting overwritten. I did try just running the Auto-add and it didn't break or fix anything with the variables. I now can not recreate the issue with the scene loading wrong, but the variable loading wrong is still an issue.
Here are two save files - one where variable 23 LASActive should be false, and the next where it should be true. Loading either from the other will not update the variable, it will just stay however it was. Meanwhile, variable 18 Time updates just fine.
https://blekkenhorst.ca/2021/wp-content/uploads/2023/01/PeoPoli_4.zip
Is it possible those extensions are affecting the scene issue? Whenever possible, the best way to extend AC is through custom events.
I can't work with the save-files without the associated project. If you use the Save-file Manager I mention above, however, you can share screenshots of the data involved. In particular, the "Global Variables" section in the "Main data" section for the two files involved.
Are these variables linked to anything, e.g. Options Data or Custom Script?
The variables in question are not linked to the edits. There were a few (like the Highlight script) that have been edited by other departments.
The only edits we have associated with the save system are the ones discussed here: https://adventurecreator.org/forum/discussion/12145/remember-whether-a-gameobject-is-enabled-when-save-loading#latest I've made another one based on RememberMultipleEnabled called RememberBrowserHistory which just remembers a list of strings rather than a list of gameobject's activations. I haven't noticed any issues with these, they work as expected. Here's the RememberBrowserHistory in case it's the culprit:
and the editor
This is the editor when I save the game, and LASActive is false:
Then I play until LASActive becomes true, load the save - the save still says False but the AC Game Editor shows true.
Thanks for the details. The script you've posted shouldn't factor into this.
Just to rule out this not being a case of the variable being set to True (rather than not updated at all), what is the behaviour of setting it back to False before loading the save file as above? Does it now remain as False, or revert back to True?
As I can't recreate the behaviour on my end, it may have to be a case of you PMing me a project .zip that I can access to see the problem for myself.
Good call - I tested it, and it IS changing the variable to the opposite of what it's supposed to be, not just leaving it at whatever it's set to.
I will zip and send you the project.
One way to recreate:
*Result: LASActive is set to true (even if you manually set it to false while sitting on the couch.)
The reverse also works.
If it helps, another way to reproduce in a different scene:
* Load Hub_Street
* Set Global Variable 19 'Level' to L2
* Set GV 18 'Time' to Morning
* Play, save first save slot as soon as the cut scene ends. (GV 23 'LASActive' is false, no icon in corner.)
* Navigate to the bus stop/bus
* LASActive will become true after cut scene
* Set to false
* Load the save,
* Result: LAS has set to true
I found a way to reproduce the original issue - loading a save from the same scene loads properly - the camera is in the right place. But loading a save from another scene triggers the OnStart cutscene instead.
Thanks for the steps, I'll follow them and see.
This occurs because your loading scene is configured in the Settings Manager, but the scene itself is not listed in the Build Settings.
I'm sorry I never responded to this! I turned off the loading screen (and left the loadingscreen in the build settings just in case.) This did fix the issue with it reloading the opening cut scene, but there are still problems. Is mostly seems to be an issue with the street scene - sometimes a save that should be Hub_Street will load Hub_Office instead, and will consistantly load Hub_Office instead.
Also, how do I create the first autosave file? There is only an option for "Overwrite existing file" and this doesn't seem to initially create the autosave.
If you can PM me an updated project with steps to reliably recreate the issue, I can look into it.
If "Overwrite existing file" is set to overwrite the Autosave, but no Autosave exists, it'll create one automatically.
It's weirdly not creating one in the first scene of the game, but it does make one in a later scene.
I deleted all the save files to figure out how to recreate the issues and of course it's not recreating - I'm doing a LOT of save testing in the next week, I suspect it may surface.
The save buttons allow me to use an "actionlist on click" - is there anything like that for the load buttons? It would be nice to fade out the scene while the save file is loading.
Yes - a SavesList element set to "Load" will have a similar ActionLists asset field.
In the case of loading, however, you'll likely want to run an ActionList that fades-out before the actual loading occurs.
To do this, uncheck Load when click on?, and then assign an ActionList that fades the camera out in the ActionList when click field. If this ActionList has an Integer parameter defined, it can be set by the element automatically to the clicked save slot - which you can then use to load the game manually with the Save: Save or load Action.
Hmm, I must have misunderstood a step, now clicking on the button does nothing except highlight the button.
Here is what I have:
(I am using a Unity Prefab, so all the buttons are listed as being missing when I am not in prefab mode but they have always worked before, so I don't THINK that is the issue?)
Oh my goodness this game is so haunted. Seconds after I posted this I tried loading a save again and the loading works, but the scene does not fade out and I suspect loading is taking a touch longer.
I didn't touch anything, I've been testing other things with the save system, but now
for some reason fading out is working but I'm getting this error:
NullReferenceException: Object reference not set to an instance of an object
AC.GVar.set_FloatValue (System.Single value) (at Assets/AdventureCreator/Scripts/Variables/GVar.cs:766)
AC.GlobalVariables.SetFloatValue (System.Int32 _id, System.Single _value, System.Boolean synchronise) (at Assets/AdventureCreator/Scripts/Static/GlobalVariables.cs:327)
TimePlayedCalculator.Update () (at Assets/TimePlayedCalculator.cs:43)
TimePlayerCalculator line 43 is just
AC.GlobalVariables.SetFloatValue(35, startTime);
It's not even the first GVar set in the update loop.
What is your AC version now? This may be addressed in the latest release.
You'll need to check Wait until finish? in the Camera: Fade Action to ensure the transition is shown in full before the loading process kicks in.