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

when i press the start (menu) button then Console says error. Error: NullReferenceException: Object reference not set to an instance of an object uiManager.Update () (at Assets/scripts/uiManager.cs:21) pls help me!

$
0
0
using UnityEngine; using System.Collections; using UnityEngine.UI; public class uiManager : MonoBehaviour { public Text ScoreText; bool gameOver; int score; // Use this for initialization void Start() { gameOver = false; score = 0; InvokeRepeating ("scoreUpdate", 1.0f, 0.5f); } // Update is called once per frame void Update() { ScoreText.text = "Score: " + score; } void scoreUpdate(){ if(gameOver == false) { score += 1; } } public void gameOverActivated(){ gameOver = true; } public void Play(){ Application.LoadLevel ("level1"); } public void Pause() { if (Time.timeScale == 1) { Time.timeScale = 0; } else if (Time.timeScale == 0) { Time.timeScale = 1; } } public void Replay(){ Application.LoadLevel (Application.loadedLevel); } public void Menu (){ Application.LoadLevel ("menu"); } public void Exit(){ Application.Quit (); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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