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

Unity 4.5 - OnMouseExit not working

Discussion in 'Editor & General Support' started by carlos_cabral, May 29, 2014.

  1. carlos_cabral

    carlos_cabral

    Joined:
    Feb 19, 2014
    Posts:
    6
    Edit: Ops, OnMouseEXIT not working >__<

    The video exemplifies the error.



    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class Teste : MonoBehaviour {
    5.  
    6.     void OnMouseOver ()
    7.     {
    8.         print ("Hover");
    9.     }
    10.  
    11.     void OnMouseExit ()
    12.     {
    13.         print ("Exit");
    14.     }
    15.  
    16.     void OnMouseDown ()
    17.     {
    18.         print ("Click");
    19.     }
    20. }
     
    Last edited: May 29, 2014
  2. iAmHokum

    iAmHokum

    Joined:
    May 30, 2014
    Posts:
    1
    I've run into the same issue using a menu that was functional in 4.3. Upon hovering over a new button, the OnMouseExit function is called on the last button. This also messes with the OnMouseUpAsButton function, because Unity still thinks my mouse is Hovering over the button.
     
  3. shochet

    shochet

    Joined:
    Dec 17, 2013
    Posts:
    30
    Same problem here after updating from 4.3.4 to 4.5 today. I reproduced the problem with a Mesh Collider and a Box Collider on a simple quad mesh. I do get a mouse exit when the mouse enters a different collider on a second quad, so my workaround was to put a large collider (size of the screen) in the background behind everything.
     
  4. Melo82

    Melo82

    Joined:
    Aug 1, 2013
    Posts:
    3
    I really does not work, I have to:

    Code (CSharp):
    1. void OnMouseDown () {
    2.        Debug.log ("OnMouseDown");
    3.        Destroy (this.gameObject);
    4. }
    at the pc works perfect but a phone with android does not enter the method.
     
    Last edited: Jun 9, 2014
  5. ajgr

    ajgr

    Joined:
    Nov 24, 2012
    Posts:
    29
    OnMouseExit has been broken on and off since 2010. Version 4.5 lists it as being fixed again, but under 4.5.3 it is broken again. Probably best to just stop relying on these alltogether.