- Home /
How to show a portion of a guitext
Hello, There is a GUIText in my scene that I want to have partially covered up. My first thought was to put it behind a transparent guitexture, but I tried and it and realized that was a dumb idea because you can see through the texture and see the text. So far I know that the texture has to have a lower z-value than whatever is covering it, but I still don't know how to cover the text successfully and make the covered part transparent.
Any Ideas?
Why covered up? Like, do you want to show half the text or what?
just covered, it doesn't matter how much is covered. Could be half, could be a little, just covered. I don't want it taking up the whole screen
Dude use the new GUI in 4.6. And when you want to hide the text, simply get the text component and change it's value to nothing if you want. Or take half the word out. That simple.
Answer by rezki · Jan 01, 2015 at 10:01 AM
1- have a GUI.Box with a transparent background using (GUIStyle) "50 x 25".
2- inside that GUI.Box Draw your text (GUI.Label) and use GUIStyle to customize it "50 x 50".
when a GUIElement is bigger than the Box its drawn on half of the GUIElement will be transparent.
I think that might work, but I'm skeptical because I have the text moving at certain points.
Your answer
Follow this Question
Related Questions
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
GUI 2D Bounding Box 1 Answer
GUITexture touch play animation 0 Answers
GUITexture is lagging my object 0 Answers
GUI.depth for use in same script or inherited script 2 Answers