Sprite Masks
Big Picture
Big Picture
Sprite masks can be used to selectively show or hide portions of a sprite. A few examples of how one might use this:
- Flashlight - A flashlight in a black screen, where you can see the level and character if they are inside your flashlight circle. Everything outside your circle could be black.
- Splatter - Paint/blood splatter. A paintball hits a player, and you generate a splatter pattern on the hit spot. Instead of half of the splatter being on the character and half floating in the air, you could have the splatter only be shown inside the player's body. This would mean you could see the portion splattered on the player, but the rest would be hidden.
- Secret passageways - Secret passageways that you can't see until you get close - a circular sprite mask around your player only reveals hidden things when you get close.
Some Great Sprite Mask Videos:
Some Great Sprite Mask Videos:
- Unity Sprite Mask - Easy - YouTube video (5min, Dec 2017) by BlackThornProd - A very short and specific tutorial demonstrating how to make a sprite mask in Unity.
- Game Feel for Action Games - Cool Unity Tutorial - YouTube video (13min, Oct 2018) by BlackThornProd - Around the 4:30 mark, he walks you through how to have a blood splatter effect only show up on the players and backgrounds, but not in the air.
- Sprite Mask in Unity - Easy Unity Tutorial - YouTube video (1.5min, July 2018) by Mikey Cee 613 - No speaking, just the bare bones video walk through of how to make 3 things (1) sprite mask (2) object hidden by sprite mask (3) object shown by sprite mask.
- Unity 2017 New Features - Sprite Masking - YouTube video (7min, July 2017) by inScope Studios - Really calm, slow and clear walk through of how to use a sprite mask. His example is a window where you can only see the background and moving clouds inside/through the window frame (not outside).
Other Sprite Resources:
Other Sprite Resources:
- "Unity 2017 2D Techniques: Build a 2D Pinball game" webpage tutorial (Sep 2018) by Arai. This tutorail walks you through how to make a pinball game. The section titled "Scrolling Trees" briefly shows you how to use a sprite mask to show only a portion of the circular rotating sprite.
- "How to use multiple Sprite Masks" on Unity Forums - A very short Q&A about how to use multiple sprite masks. Have each one only affect a custom range of sorting layers.