Hi! I just gave this tutorial a whirl: https://www.adventurecreator.org/tutorials/saving-custom-scene-data
It isn't throwing any errors, but it's also not doing what I expected it to. I have a vines object with a public int vinesCount that I want to be tracked in this scene. Right now, when the character uses a knife on the vines, it changes the vinesCount. That works fine. When I leave the scene and come back, I want it to load the same vinesCount # that it left with. Not sure if I misunderstood the tutorial, but is there a step I'm missing? Should I just save it as a global int and move on? (It isn't applicable in any other scene.. but it keeps reseting on load). Suggestions? The remember script I wrote using the tutorial is here:
https://pastebin.com/GUvVMhD1 The vines object has RememberVines and VinesInteraction scripts attached (VinesInteraction is what alters the vinesCount).
Thanks!
Comments
relying on a local variable should indeed be enough - no need for a
custom save script. Know, however, that a custom save script shouldn't
need any special "resetting" etc functions - it should save/load data
automatically when moving between scenes. Certainly nothing like manipulating GameStates should be necessary.
Are you manipulating the local variable through code, or is it disappearing naturally? Try it in the latest release (even if it's in a backup/duplicate project).
You must always read the "Upgrade notes" section in the Changelog for each update, as they contain information about changes that may affect your project.
If you're having issues after updating, by all means post them in another thread and we can look into them.
You can fix this by giving your script a positive Execution Order value, which will cause it to run after AC's Start function.
Re: Conversation issue - yes, that'll be a separate issue. Please post a new thread for that.
When you say the var completely vanishes, do you mean from the Variables Manager? If so, that would account for the error you're seeing.
Are you switching to a non-AC scene, and how are you switching to and from it? Running the code works fine for me, so it sounds like there's some key detail missing that hasn't been accounted for. Which platform are you working on, and what version of Unity, specifically?