Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Game Over page score is always 0

$
0
0
I'm following Mike Geig's infinite runner tutorial but even though the scripts are identical my game over page always says 0 as the score and I don't know why. this is the game over script where I think something might be wrong using UnityEngine; using System.Collections; public class GameOverScript : MonoBehaviour { int score = 0; void Start () { score = PlayerPrefs.GetInt("score"); } void OnGUI() { GUI.Label(new Rect (Screen.width / 2 - 40, 50, 80 ,30), "Game Over"); GUI.Label(new Rect (Screen.width / 2 - 40, 300, 80, 30), "Score: " + score); if(GUI.Button(new Rect (Screen.width / 2 - 30, 350, 60, 30), "Retry?")) { Application.LoadLevel (0); } } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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