Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Warning: Game scripts or other custom code contains OnMouse_ event handlers

Discussion in 'Editor & General Support' started by DannyB, Nov 27, 2012.

  1. DannyB

    DannyB

    Joined:
    Jun 20, 2012
    Posts:
    214
    Hi,

    After upgrading to Unity 4, I am getting this warning when building for iOS.

    Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()​

    My code contains only OnMouseDown() - for example, on buttons - and I have a small attached script that converts touches to OnMouseDown()

    Should I be worried? Replace my method with something else?

    Does anyone have more information about what exactly is the impact on performance? Which handlers?
     
  2. login4donald

    login4donald

    Joined:
    Jan 3, 2012
    Posts:
    462
    I don't think iOS support OnMouse events. Try GetTouch.
     
  3. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    I agree - this check is nonsense.

    It gets even funnier because I don't use OnMouseX method names with MonoBehaviours, but inside my framework code. The method only has the same name: OnMouseDown, OnMouseMove etc. (usual naming convention for event handlers on any platform).

    I believe Unity should drop this check altogether, or provide a switch to turn this notification OFF.

    $Screen Shot 2013-03-14 at 11.49.33 PM.png
     
  4. Cawas

    Cawas

    Joined:
    Jan 14, 2010
    Posts:
    121
    Last edited: Nov 18, 2014