Are OnMouseDown() performance issues real?

Hi there,

My game is starting to look like something that could actually be called a game, so I decided to try it out on my iPhone. I only had to fiddle a little bit for it to actually work (the use of TimeSpan compiled on a PC seems to mess it up), so I was thrilled to play it for the first time on my phone!

One thing though - I couldnt help to notice the warning from Unity:

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.

I’ve used OnMouseDown() on my sprites to get some code to fire when i, well - click them. And this seems to work just perfect on the iPhone as well as Android. I’m a bit puzzled why I get this message now that it works so well.

Reading a bit about it on the forums I can see you’re supposed to use some touch-input-stuff, but I’m still interested in the game working on a PC, so what would the smart man do here?

Ignore the warning? Make support for multiple input types (samples very much welcome, I’m still rather new to Unity! :))? Something else?

Looking forward to your suggestion.

// Yoc.

Interesting that you got no answer, because I too have been dealing with this and could find no real answer online. Lots of questions, but no one seems to know anything concrete about it. At some point apparently the OnMouse* events were not supported in mobile (which made people create raycasting scripts to do so), but it’s obviously working now, so I wonder if there’s any reason to try alternate methods on mobile platforms at all. Regardless, the warning is pretty annoying when trying to keep your scripts clean and strict.

Make platform dependent code : http://docs.unity3d.com/Manual/PlatformDependentCompilation.html