How to do inverted UI masking in Unity

preview_player
Показать описание
The UI "Mask" component in Unity doesn't allow to do reverse masking, but fear not, there's a simple solution.

Рекомендации по теме
Комментарии
Автор

For those who want the mask to move and the background not to move:
Set different Materials to the mask and the bg
Mask:8, 1, 2, 255, 255, 0;
BG:3, 2, 0, 0, 1, 15;
Then you can just put the Mask and BG the child of the canvas, and the mask needs to be upper
Finally, you can move the mask now

dabu
Автор

Wow this is so much simpler than I thought, you'd think Unity would just provide these materials by default. Thanks!

Seekay
Автор

My man, just wanna let you know you are a LIFE SAVER. I've been like 4 hours or even more on this, because when I loaded new scenes through doors in my game, the other methods (with scripts to create new stencil materials) just broke and didn't create the black masked material for some unknown reason. I've been searching this whole time and, after a short break, picked up your video. Thanks!

vleozin
Автор

Thank you very much! I've been looking for this all day!

xyxdvhn
Автор

I was looking for this. Great tutorial. Thanks!

gorkemvids
Автор

Thanks you so much! I needed to do normal masking, but without parenting so that I could anchor to the correct element, and this finally did the trick!

jakubhronik
Автор

Thanks a ton for this video, spent a few hours looking for this solution and luckily I stubled upon this!

Davis_Bogdanovs
Автор

Thanks mate, just what I was looking for!

quantum
Автор

invert masking is what I need guys and dudes, thanks.

softwarecprogrammieren
Автор

Hey man thanks alot! Also for anyone that want's the reverse effect, I changed stencil id on masked material to 1 (so both materials have same id) and it worked

Trasqual
Автор

This is excellently simple and useful!
Such a great way of doing tricky things.
Thanks a lot!

andywildsnake
Автор

Wow I was looking for a method that works. Thanks for the info

ElBuhoNincha
Автор

Quite an awesome vid, it was exactly what I was looking for. Thanks a lot for sharing!

tizianofranza
Автор

Thank you very much for the lesson, great video! I wish you success with your project :)

pxupqki
Автор

Awesome tutorial! This is really useful!

necrokmo
Автор

Thanks, this just magically worked. You are awesome :)

abdoreda
Автор

It actually freaking worked, thanks a lot <3

NoPoint
Автор

Thank you for this, exactly what I needed!

syrupsprinkles
Автор

Thanks for the tutorial, I think inverted UI mask should be available in unity built-in components

min-ofcv
Автор

Do not set the alpha channel to 0 in the UiMask material settings and everything will work for those who do not

SpanielGames
join shbcf.ru