Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Ok so we can put Unity's Mask component aside for now. Just looking at UIMasked, the Stencil section says...

Ref 0 (the value to look for in the stencil buffer)

Comp Less (if the stencil buffer's value is less than 0, then draw this pixel)

Is my understanding correct? So... does this mean the parent has to write -1 to the stencil buffer for any pixels to be drawn? Sorry if this is basic stuff; just trying to understand what's happening here so I can troubleshoot.

EDIT: I kinda got this working? I just copied the stencil segment from a sprite mask shader that I was using elsewhere. Right now it's:

- Ref 1

- Comp equal

- Pass keep

And this appears to work with Unity's UI Mask component. I think the Mask writes 1s across the whole rect, and this shader keeps whatever pixels were written as 1 (anything within the parent rect). Dunno if this is how it's supposed to work, but at a glance it's working!