I am making a game and I have a coin count text. It is using a GUI text because in MonoDevelop, I am not able to make a UIText. When I try to make the public UIText, there is only and option for GUIText. Is it not called a UIText, or does my MonoDevelop have a bug?
I want to put a UI image as a child of my CoinCount Text but I can’t because the GUI can’t be in the Canvas and the UI can’t be under a GUI object.
Unless you are using some plugin from the assetstore, there is no class called UIText
There is the legacy GUIText, UnityEngine.UI.Text (probably the one you want) and then there is the legacy GUI/GUILayout.Label.
If you add
using UnityEngine.UI; add the top, you can use something like
public Text text; to reference your text field in a script, simply drag your gameobject with a Text component to this field in the inspector and change the text by saying
text.text = "yourtextgoeshere"; somewhere in your code (in Update() for example).
If you don’t add
using UnityEngine.UI; then
public UnityEngine.UI.Text text; would do the same thing.
If you are having trouble using them. You could look at the Tutorial section, specifically the section about UI.