Search Unity

The "OnMouseOver" function won't work for UI objects

Discussion in 'Scripting' started by Volt777, Mar 19, 2019.

  1. Volt777

    Volt777

    Joined:
    Aug 6, 2018
    Posts:
    16
    I am trying to make an object appear and disappear when i hover over an UI object. When I tried this nothing happened when ran with the "OnMouseOver" function on the UI object as if the script was not there.
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
  3. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    487
    Indeed, OnMouseOver can't be used for UGUI objects. You have to implement the IPointerEnterHandler interface.

    Cheers,
    Sam