Hi, the playerprefs doesnt work in my project. Where am I making mistakes i dont know. Could you check this code?
using UnityEngine;
using UnityEngine.UI;
public class Dice : MonoBehaviour {
public Text score;
public Text highScore;
void start()
{
highScore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
}
public void RollDice ()
{
int number = Random.Range (1, 7);
score.text = number.ToString();
PlayerPrefs.SetInt("HighScore", number);
}
}
,
↧