Hello all,
as far as I understand, vars linked to options data are stored in PlayerPrefs.
Now if I
will the value of X be changed to "6" (= override the previously saved PlayerPrefs) on their device then or will it remain at "4"?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I believe it should remain at 4. If a variable is linked to Options Data, then the value you specify in the Variables Manager is only used to set it's initial PlayerPrefs value. Once this has been saved in the user's options, it should remain as such until it's specifically changed through e.g. Variable: Set Action.
This is, of course, assuming that the PlayerPrefs data does not get reset upon updating an app. Whether this is the case or not would be down to Unity's behaviour - not AC - but I don't think it does get reset.
Ok, I see, Chris – thank you.
No, they don't get reset, not unless the app itself is deleted.
Actually this is about releasing additional chapters to a game after its initial release (as you might have guessed) and I am looking for a way to … let's say: conditionally "change from a scene to the credits rolling" depending on how many chapters are released so far.
Another idea then: is there an easy way to for a non-coder to integrate a global AC var with Unity's new "Remote Settings"-Addon that e.g. allows to change a AC var's value from "at home" (thus unlocking a door to new chapters without updating the game app build itself?
https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettingsScripting.html
It would require coding, but not much. AC's variables are designed to be easily accessible through simple scripting - see the "Variable scripting" chapter of the Manual as well as the front page of the Scripting Guide.
This is untested, but adapting the code on the page you linked to should allow for remote control over an integer variable used to determine the number of available chapters:
One more (unfortunately urgent) question, Chris:
Will this change take effect on the player's device when he updates the app?
Or will it get ignored (as PlayerPrefs survive updates)?
Thanks!
The change will take effect, but it'll also replace any values stored in save game files, since those variables are now no longer part of "regular" save game data.
So when a user updates and restarts, the values should become whatever their default values are set to in the Variables Manager.
Naturally, you should test this before pushing such an update live.
Looking through the codebase now, though, there would be an issue with the current release in the event that the user then loads a save file made from before the update. In this situation, the variable value would revert back - because it was included in the save file at that time.
To fix that, open up SaveSystem.cs and find the following inside the UnloadVariablesData function:
Just undeneath, add the following:
That'll cause option-linked variables to be ignored when loading a save game file, even if they were originally part of that file.
Thank you, Chris - this is working now.
And I have (and love) to thank you even more … https://adventurecreator.org/forum/discussion/10915/stromhall-noel-2020-a-logical-christmas-calendar-released