Here’s my code:
using UnityEngine;
using System.Collections;
public class WhiteCount : MonoBehaviour {
public GameObject killer;
// Use this for initialization
void Awake()
{
this.killer = GameObject.Find("blobKiller");
}
void Start () {
}
// Update is called once per frame
void Update () {
guiText.text = killer.GetComponent<blobKiller>().whiteCount.ToString(); <---This line throws the error
Debug.Log(killer.GetComponent<blobKiller>().whiteCount.ToString());
}
}
I’ve attached the object being referenced to the script in the inspector AND set it in Awake(), but the error is still being thrown on update. I have no idea why, I can’t see what I could possibly have missed.
Can anyone help?