Question by 
               ZachAttack9280 · Sep 15, 2015 at 02:43 AM · 
                playerprefssavingsave datasaveloadsave scene  
              
 
              PlayerPrefs Not Saving When I Click the Button.
All i can say is here is the code cause i am soo confused: using UnityEngine; using System.Collections;
public class SaveData : MonoBehaviour { public float money;
 void OnApplicationQuit() {
     save();
 }
 private void Start(){
     if(PlayerPrefs.HasKey("Money")){
         Debug.Log("we have money, loading..");
         load();
         Debug.Log("Money:" +money);
     }
     
     else{
         Debug.Log("we dont have money, adding 1 and saving.");
         money++;
         save();
     }
 }
 
 private void save(){
     PlayerPrefs.SetFloat("Money", money);
 }
 
 private void load(){
     PlayerPrefs.GetFloat("Money", 0f);
 }
 
 
 void Awake(){
     PlayerPrefs.Save();
 }
 public void Clicked(){
     if (PlayerPrefs.HasKey ("Money")) {
         Debug.Log ("we have money, loading..");
         load ();
         Debug.Log ("Money:" + money);
     } else {
         Debug.Log ("we dont have money, adding 1 and saving.");
         money++;
         save ();
         Debug.Log ("saving...");
         save ();
     }
 }
 
               }
Please help me, i it wont save or do anything ( at least that i know) and when i refrash the page, my progress is gone! What is going on!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by itsharshdeep · Sep 15, 2015 at 04:14 AM
Hello.
Have you checked that log is printing when you quit your app..?? And kindly add a following save line in your save function
  private void save(){
      PlayerPrefs.SetFloat("Money", money);
      PlayerPrefs.Save();
  }
 
               Thanks
Your answer
 
             Follow this Question
Related Questions
Unity save gameobject list? (Save System) 1 Answer
PlayerPrefs help ! 1 Answer
Saving In Between Scenes and Program Exit 0 Answers
A Little Help With Player Prefs 0 Answers