Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Having a hard time with IPointerHandler

Discussion in 'UGUI & TextMesh Pro' started by Naotagrey, Oct 18, 2022.

  1. Naotagrey

    Naotagrey

    Joined:
    Apr 17, 2016
    Posts:
    37
    Hey!
    For a while I've been working on my project, and I've recently started getting issues that are new, but very annoying when using IPointerHandler (OnPointerEnter and OnPointerExit), IDragHandler, etc..
    I use those for a variety of needs like tooltips and opening panels when UI elements are hovered.

    A while ago I had to move from rendering my main UI canvas as Screen-Space Overlay to Screen-Space Camera Mode, and I've started running into a lot of issues:
    -OnPointerEnter not being called on most of the Graphic's surface
    -OnpointerExit being called next frame directly even though nothing appeared in front of the graphic
    -OnDrag not being called under similar circonstances

    upload_2022-10-18_11-10-27.png

    upload_2022-10-18_11-12-4.png


    Things I've investigated:
    -Toggle off "Raycast target" on Graphics that are in front of my triggers (like a button's icon)
    -Putting buttons' icons on a different layer (like ignoreRaycast)
    -Making sure my Graphics Raycaster does not has blocking mask for those layers.
     
    Last edited: Oct 18, 2022