Question by 
               carlosvalen · Jun 12, 2017 at 06:20 AM · 
                androidplayerprefssave data  
              
 
              I have trouble with Player Prefs.
Hi, I am makins a simple Android game and I'm trying to save the highest score the player gets, and doesn't reset everytime the player restart the game. This is my code, it saves the data between matches without exiting the game but when you close and restart the app it's 0 again.
public class puntuaciones : MonoBehaviour {
 int maxpunt = 0;
 public Text texto_punt;
 //string highscoreKey = "Max score";
 void Start () {
     maxpunt = PlayerPrefs.GetInt ("Max score");
     texto_punt.text = base_controlador.puntuacion.ToString ();
     if (base_controlador.puntuacion > maxpunt) {
         PlayerPrefs.SetInt ("Max score", base_controlador.puntuacion);
     }
     PlayerPrefs.Save ();
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
PlayerPrefs help ! 1 Answer
Are playerprefs a safe way of saving data or not?? 2 Answers
Saving In Between Scenes and Program Exit 0 Answers
PlayerPrefs working on PC but not on Android. [2020] 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                