- Home /
How to attach GUIText to Prefab?
Hi,
I've made a prefab with the hierarchy :
Parent: cube object1, cube object2, ...
Now, I need to add a GUIText to this prefab. But GUIText won't allow being under a parent (or so I think) as its coordinate system gets messed up and the text is not displaying.
Then I tried attaching a GUIText Component to a child cube game object and initialising that from code. The text value got updated but its still not displaying.
I'm assuming I've messed up in initialising some parameter of GUIText (I started Unity very recently) and despite searching for this for 2 days I'm unable to find any solution.
If anybody can help me out I'd be very grateful.
Thanks in advance Nik
why you want to add a GUIText to a prefab? What you want to achieve, I think you can do that without making the GUIText a child. PLease can you explain more whats your goal? to get specific answers
I need to view text in front of a background image I've loaded into a child cube. So, I attached a GUIText component to that child cube and initialized it, but text is not displaying on screen.
I think you need to use a 3DText ins$$anonymous$$d of a GUIText.
Answer by ina · Feb 13, 2013 at 12:47 PM
GUI elements are rendered by the camera.. Transform position of GUIText is based on screen coordinate between 0 and 1..
If you want to control what appears before the other: Try using gui.layer and OnGUI() instead of guitext component
http://docs.unity3d.com/Documentation/Components/class-GUILayer.html