0
\$\begingroup\$

Learning from some tutorials. Made Swipe touch scene. Have UI(virtual joystick) on canvas screen overlay. The problem is,when I am rotating character by joystick, my camera rotating too. If I've pressed on my UI, swiping script turning my camera around and I can't move the right way. How can I solve this problem?
@Byte56 So your camera is rotating, when you're trying to steer using your on screen joystick?
Yes

\$\endgroup\$
1
\$\begingroup\$

This is a common problem, a common solution is to use a global flag. Basically, when your UI accepts input, you set a global flag (something like UIConsumingInput) to true. If you have any other inputs, like your camera rotation, you have it test to see if UIConsumingInput is set to true, if UIConsumingInput is true, you don't process input.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The problem was with my scene... My changes in scripts were not implemented into the build. Don't know why... Anyway, I made changes that you wrote above earlier and I will mark it as the right answer. \$\endgroup\$ – GuardFromUA Jun 8 '17 at 10:08

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.