+4
Not a bug

Shader that works with new UI Text?

olarme 9 years ago updated by Freya Holmér (Developer) 8 years ago 4
When I make a Standard shader and set the type to Transparent, it works fine with the text elements in the new unity UI. However, a shader forge shader creates boxes around the text. I tried changing the alpha, alpha clip, and blend mode, but no dice. Is there any way to make shader forge work with the new text UI?

Answer

+1
Answer

It's because the text element holds a texture with the font rendered onto it, which is used to cut out all the letters. You need to make sure you are using the alpha channel of this texture in the shader. The UI Text class passes the font texture up to the material using MainTex.


Add a Texture2D node and call it MainTex. Use the RGB color as you see fit, and make sure the alpha channel is multiplied into the Opacity on the output. Make sure the shader is set to Transparent.

Under review
Not that I know of, haven't looked into it yet

There is a way to manually add tags for UI.Text? I want to create a package with various effects for it.

+1
Answer

It's because the text element holds a texture with the font rendered onto it, which is used to cut out all the letters. You need to make sure you are using the alpha channel of this texture in the shader. The UI Text class passes the font texture up to the material using MainTex.


Add a Texture2D node and call it MainTex. Use the RGB color as you see fit, and make sure the alpha channel is multiplied into the Opacity on the output. Make sure the shader is set to Transparent.