Question by 
               Kevvchiks · Feb 25, 2016 at 09:13 PM · 
                playerprefssaveload  
              
 
              How to save my gold when i quit the game
I got this code
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Click : MonoBehaviour {
 public UnityEngine.UI.Text goldDisplay;
 public int gold = 0;
 public int goldperclick = 1;
 void Update() {
     goldDisplay.text = "GOLD : "  + gold;
 }
 public void Clicked() {
     gold += goldperclick;
 }
 
               }
help me to change code, when i quit game, it saves my gold
               Comment
              
 
               
              Answer by Jessespike · Feb 25, 2016 at 09:45 PM
the same way they look in the examples, except use your variables. Did you even try?
 void OnApplicationQuit() {
     PlayerPrefs.SetInt("Player Gold", gold);
 }
 
                  Your answer
 
             Follow this Question
Related Questions
About Playerprefs Save & Load 0 Answers
Saving item count with Playerprefs 1 Answer
A Little Help With Player Prefs 0 Answers
How to save the state of Canvases/Toggles? 1 Answer
PlayerPrefs Autosave [SOLVED] 2 Answers