- Home /
Custom UI material with Mask ?
Hi,
I'm trying to use a custom material on a Image component. But I need it to work with UI Mask.
I already added this :
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
And this : ColorMask [_ColorMask]
to the shader I use, but it didn't work. Even the UIMaterial given by default with Unity didn't work with mask.
Did I miss something ?
Thanks a lot
Answer by twobob · Oct 29, 2015 at 08:34 PM
The proper - and full - answer is here @raithza http://answers.unity3d.com/questions/980924/ui-mask-with-shader.html
In essence you need that "1" set for the mask to work, and the supporting structure in the custom shader. It was very easy.
Answer by raithza · Sep 23, 2015 at 10:44 AM
I'm having a similar issue right now, did you find a solution? It must be related to the stencil buffer, but I'm not experienced with shaders at all.
Your answer
Follow this Question
Related Questions
UI/Default stencil buffer for only parent? 0 Answers
UI mask with shader 5 Answers
UI Triangle Color picker 0 Answers
Select material of Canvas Renderer 0 Answers
Custom Render Queue 0 Answers