Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by tayl0r · Jun 17, 2015 at 08:58 PM · shaderunity5stencil

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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ERR0 · Feb 05, 2016 at 02:48 AM 0
Share

So I'm using this to render a sprite but as soon as I add the _Color$$anonymous$$ask property my sprite is no longer rendered at all... Tried with and without actually using the color mask property and it just won't render at all.

2 Replies

· Add your reply
  • Sort: 
avatar image
10
Best Answer

Answer by tayl0r · Jun 17, 2015 at 08:59 PM

(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
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ERR0 · Feb 04, 2016 at 06:47 PM 0
Share

So I'm using the UI-default shader as a starting point for my sprite shader, and if I have the _Color$$anonymous$$ask 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.

avatar image tanoshimi ERR0 · Feb 05, 2016 at 06:48 AM 0
Share

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

avatar image Democide · Mar 24, 2016 at 01:26 PM 0
Share

Small note: If you have spaces in your shader name, this does not seem, to work.

avatar image
1

Answer by olonge · Nov 01, 2016 at 04:32 PM

...or as in my case, if you were only interested in the text element, just use a material based on the following shader: UI/Unlit/Test

 Shader "UI/Unlit/Text"
 {
     Properties {
         [PerRendererData] _MainTex ("Font Texture", 2D) = "white" {}
         _Color ("Tint", Color) = (1,1,1,1)
         
         _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
     }
     
     FallBack "UI/Default Font"
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Vertex Shader and Non-uniformly scaled meshes 1 Answer

Please suggest Car Paint shaders compatible with Unity 1 Answer

Problems setting up a counter for room randomization. 0 Answers

Stencil shader object "colliding" with outside of mesh 1 Answer

Combine Basic Shadow Shader and Transparency Shader in Unity 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges