I am not going to show any script, which may make it complicated. In unity ,when I used the cross platform input manager for touch buttons, the raw axis values returned are in small fractions(like 0.4321,0.1123) sometimes even smaller values, like 1.2322e-10. I want the value to be 1(when keypressed) or 0(when keyreleased). Where am I going wrong, what should I do then?

The function I used CrossPlatformInputManager.GetAxisRaw("Horizontal")

  • \$\begingroup\$ Why are you using raw axis values for buttons? This doesn't sound like the right tool for the job. It would be best if you could show us an example of how you're trying to use this method, so we can suggest a better alternative. \$\endgroup\$ – DMGregory Jul 8 '18 at 9:27

That returns the coordinate of the touches, not whether someone is touching the game. Check if it's larger, then 0 to check if it's being held


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.