2
\$\begingroup\$

If I rotate my button by -180 on the Y axis I can't even click on it. If for example I rotate it 180 on the Z axis everything is fine. Why does this happen and how can I fix it ?

\$\endgroup\$
  • \$\begingroup\$ It could be based on facing direction. A button rotated by 180 on z hasn't changed its facing relative to the camera (assuming typical UI setup) while one rotated 180 on the y axis is backwards. It could be that Unity only processes forward-facing objects when doing hit tests. \$\endgroup\$ – DMGregory Apr 26 '16 at 16:43
  • \$\begingroup\$ Thats what I thought but why on earth would they do this for the UI. \$\endgroup\$ – Uri Popov Apr 26 '16 at 16:52
  • \$\begingroup\$ Mine is not to answer why. ;) Does setting x scale to -1 cause problems? If not that may be a workaround. \$\endgroup\$ – DMGregory Apr 26 '16 at 16:53
  • \$\begingroup\$ No scaling x works fine like always. I was just wondering about the Y rotation, but like a friend once said Unity is like voodoo magic. \$\endgroup\$ – Uri Popov Apr 26 '16 at 17:23
1
\$\begingroup\$

Easy fix is to set your Source Image to None, reset y rotation to 0, Color full transparent, Raycast Target Check. Then you add your Image as a child, set rotation y 180 and Uncheck Raycast Target (not needed anymore because the image is flipped, the raycast will pass trought it anyway). Set your child Image as Target Graphic in the Button component and there you go.

\$\endgroup\$

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.