Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed Aug 08, 2018 at 09:56 AM by ConorArup for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by ConorArup · Aug 07, 2018 at 11:25 AM · uimask

[UI] Is it possible to have certain elements ignore the parent mask?

Is there a way to have certain children of a mask ignore it? I'm using a scrollview which contains buttons so I want them to be cut off by the mask. However, clicking these buttons opens a pop up to the right of the scrollview which obviously are being blocked by the mask too.

Is it possible to have these elements ignore the mask?

Comment
Add comment · Show 7
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 NoDumbQuestion · Aug 08, 2018 at 01:45 AM 0
Share

Yes it is. UI $$anonymous$$ask is using stencil buffer. https://docs.unity3d.com/$$anonymous$$anual/SL-Stencil.html

What happen here is that UI mask will only show stuff that have stencil buffer = 1 or 255. As all unity UI default sprite have buffer =1 or 255. That is why stuff inside UI mask got show.

avatar image ConorArup NoDumbQuestion · Aug 08, 2018 at 08:30 AM 0
Share

So in theory, if I change the stencil buffer of the parent image to anything but 1 or 255 it will be displayed outside of the mask?

Is there any way to access the stencil buffer of the default UI material attached in the inspector? Or do I need to edit the shader?

avatar image NoDumbQuestion ConorArup · Aug 08, 2018 at 08:43 AM 0
Share

Last time I check, Unity do not allow you to change default Shader. So you have to download it from archive and change it.

So technically, If you set default UI shader or sprite shader stecil ID buffer to any number except 0. $$anonymous$$ask will consider it as invisible.

$$anonymous$$ask will only show stuff that have stencil ID = 0. Any other stuff behind the mask will be invisible.

I am not sure that is what you want. So look it this as result: https://github.com/EsotericSoftware/spine-runtimes/issues/941

Show more comments
avatar image sj631 · Sep 16, 2021 at 12:27 PM 0
Share

Just untick the maskable checkbox on UI component

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by ConorArup · Aug 08, 2018 at 09:27 AM

I managed to get it working!

Added Stencil pass to a font shader I found and now the colours are all being correctly displayed while outside of a mask!

Adding this to the shader was most important:

         Stencil {
                 Ref 1
                 Comp Greater // Greater displays it outside of mask
                 Pass Keep
             }
Comment
Add comment · Show 1 · 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 Smaika · Jun 15, 2021 at 01:44 PM 0
Share

Hi, I'm not really experienced with shader coding so please help me if you can. I tried using the same method you mentioned for an image and it worked but now the image is only displayed outside of the mask (The image has a portion inside of the mask area and a portion inside of mask area) Is there a way for the image to be drawn on tp and completely ignore the mask? I hope you understood my qustion Thanks

Follow this Question

Answers Answers and Comments

213 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 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 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 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 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 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 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 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 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

How can i use UI Mask to get a soft fade? 0 Answers

NGUI 2.7 clipping with the new UI? 0 Answers

UI Mask not working 1 Answer

UI Mask dont aliasing children images 0 Answers

Too Many Batch and SetPass Call counts while using ScrollViews 1 Answer


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