Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Daniel G · Jul 25, 2013 at 02:02 PM · javascriptiosperformancemouse control

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:

  1. Strip all mouse controls when ready for final build before release.

  2. Leave the mouse controls in the scripts but comment them out.

  3. 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.

  4. 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!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Daniel G · Jul 25, 2013 at 02:24 PM 0
Share

Any One? Thanks

avatar image cregox · Nov 18, 2014 at 07:25 PM 0
Share

postmum related: http://answers.unity3d.com/questions/716227/onmouse-event-handlers-might-impact-performance-mo.html

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best 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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Daniel G · Jul 25, 2013 at 02:48 PM 0
Share

This sounds incredible! So i can put this conditional compilation around specific parts of code then?

avatar image Daniel G · Jul 25, 2013 at 02:49 PM 0
Share

Yes! Thank you I love your suggestion! $$anonymous$$ay your $$anonymous$$arma Be raised :P!

avatar image Daniel G · Jul 25, 2013 at 02:51 PM 0
Share

@gardian06 If you don't $$anonymous$$d uprating my question if you feel it would help others too, i would be much obliged!

avatar image Daniel G · Jul 25, 2013 at 02:54 PM 0
Share

Thank you sir!

avatar image
0

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

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gardian06 · Jul 25, 2013 at 02:33 PM 1
Share

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.

avatar image rowdyp · Jul 25, 2013 at 02:40 PM 0
Share

I guess that is specific to NGUI/FastGUI

avatar image Daniel G · Jul 25, 2013 at 02:48 PM 0
Share

@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!

avatar image Quantum2 · Jul 25, 2013 at 02:48 PM 2
Share

Even with NGUI it still would not work on mobile platforms, Unity mobile does not register touch input as mouse input on the PC

avatar image Daniel G · Jul 25, 2013 at 02:52 PM 0
Share

@Quantum2 You are correct, thats what i have been reading!

avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges