- Home /
Make a GUI.Box with an outline AND a transparent center?
So, I've been trying to make a GUI.Box with a transparent center, and a black outline. I have tried several combinations (Setting a texture transparent, adding outline, all at runtime, setting texture, making outline in another function with other guis), and none of it is working. The gui is scaled to your screen so I can't just make a texture for it. Sometimes I can see the transparency but no outline, no transparency + an outline, outline but everything behind it disappears (?). Can anyone help me out?
Answer by whydoidoit · Apr 03, 2014 at 03:14 AM
So you need to make a 9 slice texture. A simple small version of the outline. Then you tell the GUIStyle to use a border which indicates which parts should be rendered as is and which should be stretched.
NHN
VSV
NHN
The border indicates how wide and tall the corners are, these N marked are not stretched. The H are stretched horizontally. The V are stretched vertically and the centre (transparent in your case) is stretched in both directions so that the texture fits your area.
Okay, thanks. I'll try that when I get home and I will see if it works. :)
Your answer
Follow this Question
Related Questions
Editing certain words in a single NGUI Text Box 0 Answers
How to render a colored 2D rectangle. 6 Answers
GUI.Button on MouseHover 1 Answer
How to make the GUI box corners sharper 1 Answer
GUI Texture Spinner - Dead Center 1 Answer