Shader error: Material doesn't have stencil properties ??
This is a new shader error for us with Unity 5:
Material doesn't have stencil properties
What is causing this? We are using a stencil buffer in the shader but AFAIK there is nothing else in the Unity docs that talk about a stencil property.
저런 에러(워닝)가 뜨면 아래 코드를 붙여넣으면 된다
(answering my own question)
There seems to be a magic property called _Stencil, which is supposed to be used for the unique stencil buffer id.
_Stencil ("Stencil Ref", Float) = 0
in full ...
// these six unused properties are required when a shader
// is used in the UI system, or you get a warning.
// look to UI-Default.shader to see these.
_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
// see for example
// http://answers.unity3d.com/questions/980924/ui-mask-with-shader.html
반응형
'게임엔진(GameEngine) > Unity3D' 카테고리의 다른 글
Important lightmap setting (0) | 2018.01.06 |
---|---|
Unity3D - 최적화를 위한 CombineMesh (0) | 2018.01.06 |
Unity 2017.3 version released (버전 출시) (0) | 2017.12.20 |
네비게이션 메쉬(NavMesh, NavMesh Agent, Off-Mesh Link, NavMesh Obstacle) (1) | 2017.11.18 |
유니티에서 알아보는 Lightmapping 과 Final Gather & GI (0) | 2017.11.12 |
So I'm using the UI-default shader as a starting point for my sprite shader, and if I have the _ColorMask property my sprite doesn't render at all. Removing the property allows the sprite to render but then it doesn't clip properly. Even if I remove the code where the color mask is being used, just having the property still breaks the shader.
I would recommend using the Sprites-Default or Sprites-Diffuse shader as a basis - why use UI-default? Without seeing your code, can't really suggest anything else
Small note: If you have spaces in your shader name, this does not seem, to work.