3
\$\begingroup\$

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:

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

\$\endgroup\$
2
\$\begingroup\$

I Solved this 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.

\$\endgroup\$
  • 2
    \$\begingroup\$ You could also do this... 1)Save the position of image. 2)Move the panel. 3)Restore the position of image. \$\endgroup\$ – Xtro Dec 30 '14 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.