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

Question IPointerEnter doesn't work when UI element following mouse.

Discussion in 'Scripting' started by TiggyFairy, Jul 30, 2023.

  1. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    413
    Hello I have a major problem with my UI at the moment, in that
    IPointerEnter
    doesn't work when UI image element is being set to the same location as the mouse, sitting between it and the inventory. This means that large and important parts of my code are not working properly. Any idea how to solve this? I've run multiple tests, and it's def the object. I've had similar issues trying to graphics raycast to get the inventory directly, so I assume pointer enter works with raycasts?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Have you turned off the Raycast Target field on this floating object?

    Otherwise, if it's in front, then it's always gonna "suck up" all the events, I would expect.
     
  3. TiggyFairy

    TiggyFairy

    Joined:
    Dec 22, 2019
    Posts:
    413
    Literally just worked that one out. lol. I keep forgetting it's there. But thank you. Fixed it
     
    Kurt-Dekker likes this.