- Home /
How can I add font effects to my GUIStyle font?
I would like to add a drop shadow/border/glow/texture to the fonts used in my GUISkin.
I know you can use a script to save out the font texture, edit it and then apply it through a custom material (lots of posts on that). However, is there any way to customize the font used in UnityGUI (i.e. through a GUIStyle/Skin)?
Answer by Eric5h5 · Sep 29, 2010 at 08:32 PM
You can't, sorry; OnGUI functions use TrueType fonts only.
Answer by auzette · Sep 29, 2010 at 09:20 PM
We created a DropShadowText script that will draw two labels, one slightly offset and darkened behind another label. Rotten performance wise, but the only way to simulate such an effect.
At least in Unity 3.0, you can use dynamic fonts to resize, and bold/italicize. That's more than was available before.
Answer by anomalous_underdog · Mar 12, 2011 at 09:03 AM
You can. Unity imports true type fonts and converts them into bitmaps (images). The idea is you extract that image as a file, edit it in your image editing tool like Photoshop, then put it back in.
http://www.unifycommunity.com/wiki/index.php?title=SaveFontTexture
Take note its not a good idea to add effects that go beyond the boundaries of the letters. Adding gradients or small drop shadows are fine.
That is one of scripts I referred to, but it is for GUIText/using a material, not OnGUI/GUIStyle objects.
Your answer
Follow this Question
Related Questions
Sometimes the GUI selectively doesn't render some letters 1 Answer
GUIStyle.CalcSize giving wrong answer 0 Answers
Is there a way to measure the pixel with/height of a string with a given font? 2 Answers
GUIStyle for GUI.label doesn't work for android? 1 Answer
Change Font Style OnMouseEnter 0 Answers