So I was trying to make a UI element to keep score in a unity (4.6) project and I'm having trouble assigning the 'Text' element to the Text variable.
So I have the text element with the script attached to it. At the moment the script is empty except from some variables being created, here it is:
using UnityEngine;
using UnityEngine.UI;
public class TextController : MonoBehaviour {
public Text text;
public int score1, score2;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//text.text = "a" + "";
}
}
In the unity UI the Text variable shows but it is empty, and it will not let me drag the 'Text' object from the hierarchy into the variable box. It shows the outline like its going to accept it but remaing 'None (Text)' when I release the click. I tried importing an already working UI from another project into this but when I added it to the hierarchy it removed the text element again (just for reference the text worked perfectly in the other project).
Also a screenshot of the hierarch just in case:
Is there a problem with the scipt or the prject or have I messed something else up?
Edit:
Clicking the circle next to the text variable brings up the window to select the element. Mine shows up without anything in it. I expect it to show the text object I have made.