- Home /
OnMouseDown works fine for iOS
OnMouseDown seems to work fine when I build to my iPhone. Why is there so many examples of people using raycasts and other more complex ways of detecting a tap? Are there any issues with using OnMouseDown for ios that I should be aware of?
I were thinking the exact same. Guess it's a new thing that On$$anonymous$$ouseDown etc. works as touch input, but it's really great! :)
Answer by zeh · Sep 23, 2014 at 03:11 PM
The examples exist mostly because for a while Unity didn't really support OnMouse* events on mobile platforms, so a workaround was needed. It does support it now, although it gives you some warnings about performance.
To my knowledge, no real alternative exists; surely you can do all raycasts yourself, but that looks like a pretty convoluted way to do something that would have performance issues of its own (and probably what Unity is doing internally anyway).
Right now, using OnMouse* away seems to be the right way to go. Just don't waste it capturing events you don't need, I suppose.
Answer by bilo-lwabona · Dec 13, 2013 at 07:40 PM
Have you tried using OnMouseDown
with multiple fingers on the touch device?
One possible reason they would be using raycasts is because that can cater for multitouch, using the respective touchpoint's position as the screen coordinate from which to cast the ray.
OnMouseDown
does work nicely, but the system might only cater for the first touchpoint touching down on the touchscreen ... However this is probably only a concern on larger devices, not necessarily a smartphone.
Your answer
Follow this Question
Related Questions
How is "Touch.tapCount" bounded? 1 Answer
iOS Mobile - Mouse Input vs Touch Input 1 Answer
touch game objects on ios 1 Answer
Detect a tap versus standing touch on iPhone? 3 Answers
Remove Y-axis clamp from Tap to Move, Drag to Look Script 0 Answers