- Home /
Instantiate GUI text
Hey there, I was wondering if it was at all possible to Instantiate a GUI text just as you would a game object. Here is a JS of what works for a regular game object:
var object : Transform;
function OnTriggerEnter(hit : Collider){
Instantiate(object, Vector3(3,5,7),Quaternion.identity);
}
So, I'm kinda thinking it might be the same to perform an operation like this only with a GUI text instead of a regular 3D game object. If so, I'd really like to know how, but if not, I'd like to know that too. Thanks!
i try to instantiate gui text on a panel but the clone text is no displaying on the parent panel...
here is the c# code which i have used....
Answer by ScroodgeM · Aug 07, 2012 at 09:02 PM
GUIText is a GameObject like almost all other. so you could do with it everything you could do with GameObjects. just remember that GUIText uses it's position by it's own rule to display 8)
Simply put, if it's turned off (unchecked to the left of the name), that makes it not show, but once the trigger object is touched, I'd like it to show. Is there a way to do that?
void OnTriggerEnter(Collider other) { GetComponent<GUIText>().enabled = true; }
Sorry, that didn't exactly work. Is it JavaScript? Where does it go? How does it apply to the GUI text?
this is C#. is method should be in script, that attached to object with trigger and guitext components
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Creating an object and setting fields before object begins running 1 Answer
Instantantiate relative to parents position 1 Answer
AddComponent() causes a "trying to create a MonoBehaviour using the 'new' keyword" warning 2 Answers
How to call a MainClass Funktion ? 1 Answer