Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

OnMouseDown function workig on iPAD2?

Discussion in 'iOS and tvOS' started by flapyfox, Jan 16, 2013.

  1. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    407
    The mouse functions are not supported for touchscreens instead you should touch functions, but today I accidentally dicovered that it just worked with Unity4. Is that an update? does it only work on iPAD2?
     
  2. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    We enabled OnMouseDown event processing with Unity 4 release. If you have no scripts with OnMouseZZZ event handlers then your app will hit faster path with no overhead. Otherwise if you have at least one of these handlers engine will start processing these events, which will take small amount of CPU time. It should work on all devices supported by Unity 4.
     
  3. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    118
    So you should wrap theese in

    #if !UNITY_IPHONE || UNITY_EDITOR
    #endif

    :)
     
  4. AlanGameDev

    AlanGameDev

    Joined:
    Jun 30, 2012
    Posts:
    437
    @Mantas Puida : Does the event processing gets activated on a per-app basis? For example, I use OnMouseXXX only on a very minor scene (credits), will the whole game (all scenes) have an overhead because of that?
     
  5. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Yes, it is per app.
     
  6. AlanGameDev

    AlanGameDev

    Joined:
    Jun 30, 2012
    Posts:
    437
    Thank you for your reply.
    Is it possible to somehow explicitly activate or deactivate that feature? It doesn't make much sense IMHO to have an overhead the entire runtime just because of a single onmouse that may go unnoticed... Since it seems Unity 5 is getting rid of some overhead here and there I think it's an appropriate time to deal with that, nope? :).
     
unityunity