-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yaroslav Petrichka
authored
Apr 29, 2023
1 parent
048ac39
commit 226077e
Showing
1 changed file
with
8 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
# UIMask | ||
# What is it :mag: | ||
|
||
Reverse Mask of Unity "Mask" component. | ||
![mask_test](https://cloud.githubusercontent.com/assets/7010398/10592593/955f4836-76c5-11e5-9262-81b36b241c68.PNG) | ||
|
||
How to use: | ||
# Usage :computer: | ||
|
||
1. Download shaders from the provided link | ||
Add a `Mask Inverter` component to the child UI element of the Mask component | ||
|
||
2. Put them into your project (anywhere would do, but keep in mind your own project hierarchy) | ||
`DreamCode > UI > Mask Inverter` | ||
|
||
3. Notice that there are two shaders (UIMask and UIMasked). You need to create two materials (i.e. ReverseMask and ReverseMasked). | ||
![image](https://user-images.githubusercontent.com/7010398/235316659-6f0c5d83-8d86-4a0d-aaaa-baddd7e9d72a.png) | ||
|
||
4. Create a new material (ReverseMask) and under "Shader" drop-down menu, select "IndieYP->UIMask". As it's texture, put the texture that you want to be the mask (in my case it was a circle, because I wanted the make a "hole" in the black background). | ||
![image](https://user-images.githubusercontent.com/7010398/235317171-d6d601dd-8f44-4aa9-a9cd-7624fe1cab68.png) | ||
|
||
5. Create a new material (ReverseMaked) and under "Shader" drop-down menu, select "IndieYP->UIMasked". Set the color of you material (in my case, black). | ||
# Samples 📖 | ||
|
||
6. Now you need to assign the materials to your game objects. ReverseMasked goes to the game object that you want to mask (in my case, panel that's serving as a background). ReverseMask goes to game object that's going to do the masking, in my case, image that's set as a child of the mentioned panel (this is very important). | ||
|
||
Also, set the same texture (that you used for ReverseMask) as a source image for Image game object. | ||
See `Assets\Examples\Scenes\ExampleScene` |