"Object reference not set to the instance of an object"
Hey all, So, today I've been trying to program a timer for a game I'm making. In the game, the timer counts soun from 60 seconds to 0, and at 0, the game ends. Just as a placeholder for the moment ( because I can't seem to get it to count down in seconds) I have set the timer value to 60, and applied the scrit for the timer to a text so the value is seen visibly counting down. Here is the script I have:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Timer : MonoBehaviour {
public int timer;
public Text timerText;
public GameObject Timer
// Use this for initialization
void Start () {
timer = 600;
}
// Update is called once per frame
void Update () {
timerText.text = timer.ToString (Timer);
timer -= 1;
}
}
The error seems to happen line 18. It is indeed, rather annoying. Any and all help and pointers would be greatly appreciated, thanks :)
Comment