Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var Text : UnityEngine.UI.Text;
- var Text1 : UnityEngine.UI.Text;
- var Score : int;
- var HighScore : int;
- function Start(){
- HighScore = PlayerPrefs.GetInt("Score");
- }
- function Update () {
- Text.text = "Score: " + Score;
- Text1.text = "HighScore: " + HighScore;
- if(Score >= HighScore){
- HighScore = Score;
- PlayerPrefs.SetInt("Score",Score);
- }
- }
- function FixedUpdate(){
- if(Input.GetMouseButton(0)){
- Score = Score + 1;
- }
- PlayerPrefs.SetInt("Score",HighScore);
- }
Advertisement
Add Comment
Please, Sign In to add comment