Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Use SpriteMask for a blind effect

Discussion in '2D' started by Redden44, Aug 20, 2017.

  1. Redden44

    Redden44

    Joined:
    Nov 15, 2014
    Posts:
    159
    Hello, I need to make a blind effect (turn the whole screen black but an area around the player) and I tried to use the SpriteMask by simply setting the Sprite Renderer's Mask Interaction to "Visible Inside Mask" and it did the trick.
    The problem is now my sprite is no longer visible because the option makes it visible ONLY inside a SpriteMask, so if there isn't a SpriteMask in the scene, the Sprite disappears..

    Is there a way to fix this or should I ditch the thing?

    Any alternative solution beside making a big black sprite with a hole in it?

    Thanks.
     
  2. Hyblademin

    Hyblademin

    Joined:
    Oct 14, 2013
    Posts:
    725
    I think what you're saying is that when you apply your solution for a spotlight effect (a good solution), it messes up visibility for areas that should not have the effect. Is this correct?

    If so, you could have the behavior scripts for objects that can be in both areas change their masking mode based on triggers that the player passes through to enter/exit these areas.

    I guess that using positive masking using a box with a hole in it would work too. There are some other minor annoyances you'd need to work around, like screen size/resolution.
     
  3. pandaboy1942

    pandaboy1942

    Joined:
    Feb 24, 2020
    Posts:
    1
    Uhm, i think spot is not an solution. If your player just an invisible capsule, that should be plobem.
     
  4. raarc

    raarc

    Joined:
    Jun 15, 2020
    Posts:
    535
    change mask interaction to "none" when you remove the mask