Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

Saving highscore problem

$
0
0
Im trying to save the highscore for my game but i can't figure it out! I used mybringbacks tutorial: http://www.youtube.com/watch?v=1ZGDBuJjFbY On how to save highscore. Its a little complicated for me, and when i write it into my script, it says: Operator '>' cannot be used with a left hand side of type 'Object' and a right hand side of type 'int'. What do i do wrong, and how do i fix it and make my highscore? #pragma strict var score; var highscore = 0; function Update () { score = GameObject.Find("CounterGUI").GetComponent(Counter).Timer; if (GameObject.Find("Spaceship").GetComponent(Clickmove2).die == true) { GetComponent(GUIText).enabled = true; } if(score > PlayerPrefs.GetInt("highscore")) { PlayerPrefs.SetInt("highscore" , score); } guiText.text = "Best:" + PlayerPrefs.GetInt("highscore"); }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>