- Home /
OnMouseDown ect have effect on iPhone Build?
Hello, I am building a game that will be for iPhone and Mac standalone. I currently have a lot of scripts that have en masse down en masse exit on mouse over etc. I am wondering if I have a separate script running my iPhone input if this will affect the performance the game on iPhone with the code in there.
Options I see:
Strip all mouse controls when ready for final build before release.
Leave the mouse controls in the scripts but comment them out.
Use a boolean system inside EACH "OnMouseDown" "OnMouseEnter" function ect.. That will access one script that has an inspector check mark box for ISphone or ISNOTiphone. (My question here is if these ^ functions will still have an effect even if they have nothing inside them to execute besides an if statement that turns out false when the boolean is set to ISiPhone input.
Leave the mouse controls because the functions are disabled by unity ANYWAYS when exported as an iOS build? (Is this still true? i was reading an old thread that said that in 2010).
Thanks for the help! Any opinions and sources are helpful, i have dug around but I am coming up empty handed.
Daniel
PS: I take the time to rate and Mark the most Correct/Complete answer!
Answer by gardian06 · Jul 25, 2013 at 02:25 PM
the easiest way to do this will be through conditional compilation effectively having the engine comment out the code for you on Build.
I would suggest putting these around the events themselves so that the event doesn't even try to register with the engine.
This sounds incredible! So i can put this conditional compilation around specific parts of code then?
Yes! Thank you I love your suggestion! $$anonymous$$ay your $$anonymous$$arma Be raised :P!
@gardian06 If you don't $$anonymous$$d uprating my question if you feel it would help others too, i would be much obliged!
Answer by rowdyp · Jul 25, 2013 at 02:29 PM
I think mobile is geared more towards onClick since they technically don't have a mouse, however, you can still "click" button you make with your finger
no such event OnClick(), and the docs for On$$anonymous$$ouseDown specifically state they don't work on mobile. though there is no note on the other On$$anonymous$$ouseX events.
@rowdyp Yes it is, Sorry :P if you want to delete your answer that is fine with me! Thank you for taking your time to help though! Good thoughts!
Even with NGUI it still would not work on mobile platforms, Unity mobile does not register touch input as mouse input on the PC
@Quantum2 You are correct, thats what i have been reading!
Answer by Xtro · Jul 25, 2013 at 03:05 PM
Mouse controls aren't disabled by unity when pushing to iOS platform. They just work with finger taps as they were mouse clicks.
I have some 3rd party scripts that include OnMouse... events and I didn't see big impact in my iOS game. Maybe I'll comment them out if I see an impact in the future but for now, it's not a problem for me.
Notice : My scene includes two big terrains, objects with lightmapped, dynamic shadows, materials with bump+scpecular+rim shaders, high-poly meshes, camera image effects like blur. I don't see a performance impact when I disable/enable OnMouse events.
Your answer
Follow this Question
Related Questions
Game Runs Horribly Slow On iPad? 3 Answers
Bad iOS Performance after good android build. 2 Answers
Destroy Object On Collision? 3 Answers
Best Practice For Shader Complexity + IOS 1 Answer
Profiler does not show objects when hooked to an iPad 1 Answer