How to do inverted UI masking in Unity

Поділитися
Вставка
  • Опубліковано 19 тра 2022
  • The UI "Mask" component in Unity doesn't allow to do reverse masking, but fear not, there's a simple solution.
    Check out our steam page: store.steampowered.com/app/16...
    Credits to Glitchers where it's due: answers.unity.com/questions/1...
  • Навчання та стиль

КОМЕНТАРІ • 49

  • @dabu6550
    @dabu6550 Рік тому +22

    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

  • @Seekay37
    @Seekay37 11 місяців тому +4

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

  • @andywildsnake7714
    @andywildsnake7714 9 місяців тому

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

  • @vleozin
    @vleozin 2 місяці тому

    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!

  • @gorkemvids4839
    @gorkemvids4839 Рік тому +1

    I was looking for this. Great tutorial. Thanks!

  • @tizianofranza2956
    @tizianofranza2956 Рік тому +1

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

  • @user-xy3xd8vh6n
    @user-xy3xd8vh6n Рік тому +1

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

  • @jakubhronik8637
    @jakubhronik8637 Рік тому +1

    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!

  • @quantum4214
    @quantum4214 Рік тому +2

    Thanks mate, just what I was looking for!

  • @user-px7up2qk5i
    @user-px7up2qk5i Рік тому +1

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

  • @Davis_Bogdanovs
    @Davis_Bogdanovs 6 місяців тому

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

  • @necrokmo
    @necrokmo Рік тому +1

    Awesome tutorial! This is really useful!

  • @ballisticmind
    @ballisticmind Рік тому

    This was super helpful, thank you.

  • @AntonsSestaks
    @AntonsSestaks 21 день тому

    Great solution! Thank you

  • @ElBuhoNincha
    @ElBuhoNincha 2 роки тому +3

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

  • @softwarecprogrammieren
    @softwarecprogrammieren Рік тому +1

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

  • @NoPoint42
    @NoPoint42 4 місяці тому

    It actually freaking worked, thanks a lot

  • @Trasqual
    @Trasqual Рік тому +2

    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

    • @hy4596
      @hy4596 11 місяців тому +1

      고맙 :)

  • @syrupsprinkles4124
    @syrupsprinkles4124 6 місяців тому

    Thank you for this, exactly what I needed!

    • @syrupsprinkles4124
      @syrupsprinkles4124 6 місяців тому

      One question though, how do you make the edges smooth?

    • @syrupsprinkles4124
      @syrupsprinkles4124 6 місяців тому

      Answering my own question - on the image component of the mask, click Color and set alpha to 1.

  • @abdoreda7126
    @abdoreda7126 2 місяці тому

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

  • @kamuransonecek607
    @kamuransonecek607 Рік тому

    thank you guy, it is awesome

  • @creep1ch442
    @creep1ch442 2 роки тому +2

    Thank you! rly helpd me

  • @DjeaglE21
    @DjeaglE21 Рік тому +1

    Thank you so much man!!!!!

  • @mikhailcortes83
    @mikhailcortes83 Рік тому

    Thank you!

  • @SpanielGames
    @SpanielGames 27 днів тому

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

  • @Gogmosis
    @Gogmosis Рік тому

    Thank you

  • @greencoinz6615
    @greencoinz6615 2 роки тому +1

    Nice video bro.

  • @VapeStation5
    @VapeStation5 Рік тому

    Awesome!

  • @min-of8cv
    @min-of8cv 8 місяців тому

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

  • @marcozakaria5288
    @marcozakaria5288 Рік тому

    Works Thanks

  • @yojan69
    @yojan69 Рік тому

    TYSM

  • @peon5349
    @peon5349 Рік тому

    If you followed but doens't work. try "Ctrl+R" (reload asset) in unity.
    i spent hours because of this lol. after reload asset work well! thx for vid

  • @MrVip88ful
    @MrVip88ful 6 місяців тому

    thank!

  • @mooam231
    @mooam231 Місяць тому

    Not Work ㅠㅠ

  • @Cred_official
    @Cred_official Рік тому +1

    How can i make mask looks more smooth? On video it has sharp edges and pixels. Thanks for the video btw.

    • @MeetArgon
      @MeetArgon 7 місяців тому +1

      Use mask material tint color alpha 1

  • @dennissanjaya2796
    @dennissanjaya2796 4 місяці тому

    this doesn't work in Unity 2020.3.40f1

    • @jeangodecoster
      @jeangodecoster  4 місяці тому

      I honestly don't see why it wouldn't. Can you say exactly what doesn't work for you ?