unity android game score text upadates in the unity gameview but when I install the apk in my phone ,the score text does not get updated.
using UnityEngine; using System.Collections;
public class Scoremanager : MonoBehaviour { public static Scoremanager instance; public int Score; void Awake(){ if (instance == null) { instance = this; }
}
// Use this for initialization
void Start () {
Score = 0;
PlayerPrefs.SetInt ("Score", 0);
}
// Update is called once per frame
void Update () {
}
public void IncrementScore(){
Score++;
}
public void StopScore(){
PlayerPrefs.SetInt ("HighScore", Score);
if(PlayerPrefs.HasKey("HighScore")){
if (Score > PlayerPrefs.GetInt ("HighScore")) {
PlayerPrefs.SetInt ("HighScore", Score);
}
}
else{
PlayerPrefs.SetInt ("HighScore", Score);
}
} }
Comment
Your answer
Follow this Question
Related Questions
How To Generate Platforms Down Each other in a pattern with some different positions Unity 1 Answer
Calling coroutine in a method issue. 1 Answer
How to alter Right/Top Value from RectTransform 0 Answers
Unity5/C# beginner here! Need some scripting help :) <3 1 Answer
Convert Unity to Autocad 0 Answers