Forum rules - please read before posting.

How are options data affected by an app update?

Hello all,

as far as I understand, vars linked to options data are stored in PlayerPrefs.
Now if I

  • set the value of a global var X which is linked to options data to e.g. "4"
  • build the game
  • release the game via an app store
  • have players play it
  • update the build after a while and change the value of X from "4" to "6"
  • release the update to the app store
  • have players download the update and continue to play their quest,

will the value of X be changed to "6" (= override the previously saved PlayerPrefs) on their device then or will it remain at "4"?

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.

  • edited October 2019

    Ok, I see, Chris – thank you.

    This is, of course, assuming that the PlayerPrefs data does not get reset upon updating an app

    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:

    using UnityEngine;
    using AC;
    
    public class RemoteTuningVariables : MonoBehaviour
    {
    
        public int defaultNumberOfChapters;
    
        void Start ()
        {
            RemoteSettings.Completed += HandleRemoteSettings;
        }
    
        private void HandleRemoteSettings (bool wasUpdatedFromServer, bool settingsChanged, int serverResponse){
            GVar myVariable = GlobalVariables.GetVariable ("NumberOfChapters"); // An integer variable
            myVariable.IntegerValue = RemoteSettings.GetInt ("NumberOfChapters", defaultNumberOfChapters);
        }
    
    } 
    
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.
Do NOT follow this link or you will be banned from the site!