Assets/Scripts/CoinCounter.cs(12,25): error CS0120: An object reference is required to access non-static member `UnityEngine.GUIText.text’
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CoinCounter : MonoBehaviour
{
public int coinCount = 0;
// Update is called once per frame
void Update ()
{
GUIText.text = "x" + coinCount;
}
}
I can’t figure out why it is giving me this error.
NullReferenceException: Object reference not set to an instance of an object
CoinCounter.Update () (at Assets/Scripts/CoinCounter.cs:12)
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CoinCounter : MonoBehaviour
{
public int coinCount = 0;
Text text;
// Update is called once per frame
void Update ()
{
text.text = "x" + coinCount;
}
}