Can I break the UI MASK hierarchy?

I’m using unity 4.6. I saw a couple of UI masks tutorials and saw that there’s a certain hierarchy I can’t seem to break:

  • -Canvas
  • — Panel (holds the mask component)
  • --------Image

I want to move the mask and leave the image in its place.

(Attach the mask to a moving object, and by that, exposing the image by the moving object position)

I have 2 problems with it:

  1. My moving object barely moves my mask (I guess because of the canvas).
  2. The image is a child of the mask, so even if it will move, it will move with it.

Can I even do it?

I Solved it by detaching the image from the mask parent, move the mask, and then reattach it (Set the image’s parent to the canvas and after moving the mask set it to be the image’s parent again).
That way the image stays still and the mask is slowly revealing the image.

You can actually do masking without using direct ancestors. Setup your hierarchy like so:

- left mask (Image)
- right mask (Image)
- mask parent (Image + Mask + this object should be 0 size because you dont actually want its mask to be applied)
    - child object that gets masked
    - child object that gets masked
    - child object that gets masked

Once you set it up like that, you have to go into 1 of your child objects and toggle the rendering component on and off to refresh the masking setup.

Tested in Unity 5.2.2p4