RectMask2D.RemoveClippable(IClippable clippable) doesn't seem to work. Am I using it correctly?

I have a RectMask2D UI object with two Image objects as children. It works great: both the images get clipped to the object’s rect.

Goal: I want the mask to NOT clip the second child, while keeping the same parent-child hierarchy.

Issue: Calling rectMask2D.RemoveClippable(IClippable child2Clippable), child2 still gets clipped.

Am I not understanding the purpose of this method, or are there other methods that I need to call afterwards? Has anyone else experienced this? I’ve tested this in 5.3.3 and 5.4.0. The most relevant information I was able to find is a bug that I presume has been fixed already ( ).

Edit: Found MaskUtilities.NotifyMask2DStateChanged(RectMask2D mask) the other day while troubleshooting with a friend. Tried calling this with the mask reference passed in after callling RemoveClippable(), but child2 still gets clipped.

Just FYI: I have a single RectMask2D in this scene, so I’m positive there isn’t a separate mask somewhere also clipping child2.

Ah, I see now! RectMask2D, as @Bunny83 pointed out, isn’t designed at all to be a very complete masking solution. I’d actually prefer it to be named something like QuickMask2D, or maybe mention in the docs why it exists. Anyway, handling IClippable components manually seems to be the way to go.

Below is basically what I’m doing now, and it seems to be fantastic for my purposes. Any further information would be appreciated. I’m bummed out that I couldn’t find info on this stuff from searching the docs, but now that I understand IClippables, maybe I’m good to go.

private void SetClipping()
        // get all the clippables in some object's children
        foreach(IClippable clippable in someObject.GetComponentsInChildren<IClippable>())
            // call SetClipRect on the IClippable, but only if it's one of the objects you want to clip
            if (someCriteria) clippable.SetClipRect(myMask, true);

I guess alternatively you could use the second parameter of SetClipRect to pass in your criterion bool and not have the if statement, if that’s what you’re working with. Thanks again @Bunny83 for a nudge in the right direction.

You can’t do that because “MaskableGraphic” automatically registers (using AddClippable) and removes (RemoveClippable) itself from the parent mask. That is the point of the methods. They are part of the automatic process. MaskableGraphic has a private method called “UpdateClipParent” which is called by several callbacks. It automatically searches for a RectMask2D component on a parent and adds itself to the mask.

That’s the point of RectMask2D. It serves as mask for it’s children. If you don’t want to mask it, don’t make it a child of it.