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.
  2. Dismiss Notice

OnMouse events not working [fixed]

Discussion in 'Physics' started by AndrewStyan, Aug 19, 2020.

  1. AndrewStyan

    AndrewStyan

    Joined:
    Apr 6, 2020
    Posts:
    14
    Posted for others who have this problem but can't resolve it.

    Operating in URP on 2019.4.3f1 with a mix of the old and new Input systems. Some combination of actions and edits led to OnMouseOver, OnMouseExit, etc. not working. Perhaps it was never working as I was only just learning how to use it.

    Tried all the suggested tips, nothing worked.

    Finally, after a day of hair pulling, this worked.
    1) ensure that Player Settings -> Input System are set to 'both'
    2) Assets -> Reimport All

    Maybe 'Reimport All' is a catchall fix for new players :)
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,523
    Please note that this has nothing to do with physics which is where you're posting.
     
    AndrewStyan likes this.
  3. AndrewStyan

    AndrewStyan

    Joined:
    Apr 6, 2020
    Posts:
    14
    Sorry, I wasn't sure where the problem actually lay. As OnMouse... depends on colliders I thought Physics was appropriate.

    Should I move it?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,523
    No it's fine. I just wanted to highlight that it wasn't related to physics.

    Whilst OnMouse etc might use physics colliders, the mouse/callbacks are a UI thing and are not implemented, supported or related to physics; it's just another user of physics colliders in the same way that the particle system hitting colliders isn't implemented by physics. Totally understand that you wouldn't know that of course. :)

    Just for your info, these are the UI and Input forums.
     
    AndrewStyan likes this.