To clip images via Sprite Masking, follow these steps:
- Create a new Unity 2D project.
- Create a folder named Images and import the three provided images into it; that is, GAME_ROOM.png, GAME_ROOM_windowMask.png, and blueBird.png.
- Drag the GAME_ROOM image into the scene and resize it so that it completely fills the Game window. For its Sprite Renderer component, set Order in Layer to -1 (so that this room image will be behind other images in the scene).
- With the GAME_ROOM GameObject selected, from the Create menu in the Hierarchy window, go to 2D Object | Sprite Mask. A GameObject named New Sprite Mask should now appear in the Hierarchy window as a child of the GAME_ROOM GameObject:
Figure 6.62 – Adding a Sprite Mask child to the GAME_ROOM GameObject
- Select the New Sprite Mask GameObject in the Hierarchy window. Then...