- Home /
Gui Text Help
I am trying to make a set of instructions pop up on the screen. My one problem is that I am trying to call a UI text object in the game and I am trying to make the text be disabled then when I enter a trigger it is enabled. It is not working though. I also tries to use OnGUI and I don't know how to use a function in another function
Answer by Light997 · Sep 04, 2015 at 01:45 PM
Here's an example of code where it works:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Triggertext : MonoBehaviour {
public Text text;
void OnTriggerEnter () {
text.text = ("Hello");
}
}
Your mistake was probably that you didn't tell the script to use UnityEngine.UI, which is essential when doing anything script-controlled on a canvas. Hope this helped.
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
GUI text not showing in scene or game view 0 Answers
how do i attach GUITEXT to a prefab 1 Answer
Replacing letters with images? 1 Answer