Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Best way to detect any UI hovering?

Discussion in 'VR' started by MatanYamin, Aug 17, 2023.

  1. MatanYamin


    Feb 2, 2022
    Hey everyone,
    This is my case:
    I have a menu with buttons.
    I simply want to disable some logic whenever the player is hovering the menu, and enable logic when not.

    I tried to put a transparent button that fits the canvas and detect "OnPointerEnter" and "OnPointerExit" for that button. The problem is, whenever I hover another button, it will call "OnPointerExit", and the game will think the player stopped hovering the menu.

    Also, when I move the transparent button to the bottom hierarchy, this block interaction with other buttons.

    What is the best solution for this case?

    Isn't there a simple way to just detect hovering & Exiting a canvas, no matter what buttons or UI it has?