Exemple #1
0
        /// <summary>
        /// Save anything important	for loading next time.
        /// </summary>
        public void Save()
        {
            // Create a new Player_Data.
            Setup_Data data = new Setup_Data();

            // Save the data.
            data.sceneSpawnLocation = sceneSpawnLocation;
            data.sceneStart         = sceneName;
            // Turn the Setup_Data to Json data.
            string setupToJson = JsonUtility.ToJson(data);

            // Save the information.
            PlayerPrefs.SetString("Setup", setupToJson);
        }
Exemple #2
0
        /// <summary>
        /// Load anything important to setup.
        /// </summary>
        private void Load()
        {
            // Grab the encrypted Setup_Data json string.
            string setupJson = PlayerPrefs.GetString("Setup");

            // IF there is nothing in this string.
            if (String.IsNullOrEmpty(setupJson))
            {
                // GTFO of here we done son!
                return;
            }
            // Turn the json data to represent Equipment_Data.
            Setup_Data data = JsonUtility.FromJson <Setup_Data> (setupJson);

            // Load the player stats.
            sceneSpawnLocation = data.sceneSpawnLocation;
            sceneName          = data.sceneStart;
        }