Hey Everyone,
I'm VERY new to Unity (read less than 24 hours ago) and need some assistance with a monobehaviour error (even though it is using monobehaviour), I know there are a million of these to look through, and I have looked through several, but have not found my solution yet. I'm trying to make a coin type item that can be collected (similar to Mario and several other games) but the code I'm using (found on YouTube) isn't working, I've tried lowercase and caps on several item-related things, I've tried adding and removing "using UnityEngine.UI;" since that wasn't originally on my script, but it was on the one I'm copying from, and other things, I can't get it resolved. I'm editing it in Visual Studio (not sure if that makes a difference, but figured I'd put it just in case.) Thanks in advance!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GemCounterScript : MonoBehaviour {
Text text;
public static int gemAmount;
// Use this for initialization
void Start () {
Text = GetComponent ();
}
// Update is called once per frame
void Update () {
text.text = GemAmount.ToString()|;
}
}
↧