Switch from PlayerPrefs to DBManager

  • I am ishan.
    I use this script in my project.
    Please helpme how I integrate this script with

    //to get the currentCurrency
    int currentCurrency = PlayerPrefs.GetInt("Currency");
    //then i add the amount  to currentCurrency value
    currentCurrency += amountToAdd;
    //then pass the total  back to playerprefs
    PlayerPrefs.SetInt("Currency", currentCurrency);

  • Thanks for using the forum.

    As I wrote earlier today, our DBManager provides the methods necessary for replacing PlayerPrefs. Please take a second look at our scripting reference.

    In your example, that would be:

    //to get the currentCurrency
    //note that you do not actually have to do this.
    int currentCurrency = DBManager.GetFunds("Currency");
    //then i add the amount  to currentCurrency value
    DBManager.IncreaseFunds("Currency", amountToAdd);

    This is also mentioned in our documentation pdf included in the asset, page 7.

Log in to reply