Hi people!
I really don’t know what I’m doing wrong, since I’m using a UI Text and trying to set a default text but it just won’t appear.
I tried almost everything with no succeed. Do you know something related? If not, I want to ask, is there other way to handle this? I know I can print the values in console, but I prefer to have the values in the game screen rather than looking at console every now and then.
Thanks!!!
make ui text gameobject. Add lines in your script with values:
public GameObject myTextObject;
Text myTextComponent;
reference it to text component on ui text object
void Start () {
myTextComponent = myTextObject.GetComponent <Text>();
}
change later “text” variable with string variable
myTextComponent.text = stringVariable;
//you can convert you values to string with
myTextComponent.text = myValue.toString();
put ui textobject in the new scripts field
1 Like