I have a script where it takes the score from the round and is supposed to print it out via the new Unity 4.6 Ui, however it doesn’t and I get a Object reference not set to an instance of an object error along with it. I have attached the text object to the script and have used the Get Component text thing but I still get the error.
Here is my simple little script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class GameOver : MonoBehaviour
{
public int DisplayScore = 0;
public Text ScoreEnd;
void Start()
{
DisplayScore = PlayerPrefs.GetInt ("RoundScore");
}
void Awake ()
{
ScoreEnd = GetComponent <Text> ();
}
void Update()
{
ScoreEnd.text = "Score: " + DisplayScore;
}
}