예제 #1
0
    /**
     * In order to use the SaveObject, we need to initialize it.
     * It will create a SaveObject instance, make sure you link
     * correctly to the save object either with a string with the
     * Resources folder as root or a direct link to the prefab.
     * */
    void Start()
    {
        /**
         * You need to call SaveObject.Initialize before doing anything with SaveObject.
         * You can also set the refreshCallback whenever you want with.
         * */

        SaveObject.Initialize(saveObject, OnRefresh);
        //You can also set a refresh callback like this:
        SaveObject.SetRefreshCallback(OnRefresh);

        /**
         * It is recommended that you Load right after initialization, it makes sure that
         * you always have a game ready to be used.
         * The next line is commented out to show what a "None" save state looks like.
         * */
        //SaveObject.Load("Default");
    }
예제 #2
0
    /**
     * In order to use the SaveObject, we need to initialize it.
     * It will create a SaveObject instance, make sure you link
     * correctly to the save object either with a string with the
     * Resources folder as root or a direct link to the prefab.
     **/
    void Start()
    {
        /**
         * You need to call SaveObject.Initialize before doing anything with SaveObject.
         **/
        if (PlayerPrefs.GetInt("usouSave") != 1)
        {
            SaveObject.Initialize(saveObject);
        }
        PlayerPrefs.SetInt("usouSave", 0);

        /**
         * Set a callback for when you load a game like this, used to do complex updates
         * when needed.
         **/
        SaveObject.SetRefreshCallback(OnRefresh);

        /**
         * It is recommended that you Load right after initialization, it makes sure that
         * you always have a game ready to be used.
         **/
        SaveObject.Load("Saved Game No1");
    }