- Home /
Question by
sushillakra21 · Jun 30, 2018 at 11:12 AM ·
spritemask
How to create SpriteMask through script.
I am trying to create sprite mask through script.
mask = new SpriteMask();
if (mask == null)
{
Debug.Log("Mask is null");
}
and mask is always null, what can I do here.
Comment
Answer by hexagonius · Jul 01, 2018 at 12:27 PM
SpriteMask is a component. every component needs to be created calling AddComponent
Thanks for reply, Can you please share an example, it will be great help, I am literally dropping idea to use it because I can't create it through script.
you just tried with your new approach.
Check out the documentation about AddComponent
Hi, I tried with the approach you mentioned and it worked for me, thanks a ton :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612165755im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shaders to show damage? 1 Answer
Masking with Mesh Renderer (2d) 1 Answer
Where are the Sprite Masks? 0 Answers
Masked sprite batching 0 Answers