- When adding Material to UGUI , if the Shader in Material does not do special processing, then this component will become pure black.
- If you need to add Material , you need to do UGUI- specific processing in Shader .
Properties { //UI部分添加 [Header(UIProperties)] _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 //UI部分添加 } SubShader { //UI部分添加 Cull Off//剔除 Lighting Off//光照关闭 ZWrite Off//深度写入关闭 Blend One OneMinusSrcAlpha//混合模式 //UI部分添加 }
- Add the above code in Shader , then bind Material to UGUI again .