Masking 2D Sprites

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mrop

Hi!

I am trying to mask the eyes of my game character, and I am having some trouble when using Light2D.

I have constructed my character from component sprites that I can then animate like a paper doll, but I want the iris/pupil to be masked properly when the character blinks. Therefore, I have a Light2D mask that corresponds to the shape of the eyes, that I can then scale down as the character blinks. However, once the pupil and iris are outside the bounding box of the mask texture, they are no longer masked. (I tried making the masking texture larger, but of course I would eventually want a scale of 0 on the Y axis for a completely closed eye.

How do I make a mask for a sprite that does not render sprites that fall outside the bounding box of the mask?