I am using the same pickups from the roll a ball tutorial and I have already tried the script written in the same tutorial for displaying a score. One of the key parts of it is that you have a box that you have to drag the text box element in the hierarchy into the inspector of the scripts but I do not have this box. Any other ways you know of for displaying the amount of pickups collected?
I haven’t done the tutorial but if your field should be listed in the inspector and it isn’t, you probably forgot to make it public. Where your variable is listed, most likely at the top of your script, add the word public before it. If you can’t get it to work, post your script using code tags!
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
public Text winText;
...
(from the tutorial he’s referencing)
you need the “Using UnityEngine.UI;” at the top to be able to use “Text” type, and as Fujik says, the variables need to be public to expose them in the inspector (or private and [serializedfield] but you’ll get to that later )
I already had the variable public and was using the UI but i am still having this problem. is there some other way to address the canvas text instead of dragging it into the inspector as it said in the tutorial? ill post my code in a second.