Search Unity

OnPointerExit not triggered when UI element appears and interrupts a hover (using new Input system)

Discussion in 'Scripting' started by Discipol, Apr 1, 2020.

  1. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    83
    1. Hi! I am tring to make a tooltip using the New UI Input module.
    2. When my mouse is over a building on my citybuilder game, a tooltip will apear, triggered by OnPointerEnter
    3. When my mouse moves away from the building, the tooltip dissapears, triggered by OnPointerExit

    4. PROBLEM: If my mouse is over the building, with the tooltip visible, and a popup (a Canvas) appears over it, it won't trigger OnPointerExit, thus the building tooltip will still be visible, ON TOP of the popup.

    5. If I move the mouse slightly while the popup is below it, OnPointerExit on the building will trigger and hide my tooltip, but at this point it is too late.

    How can I fix this behavior? Ideally I would like to detect when a new UI element blocks an old one and triggers the old one's loss of focus but I will take any suggestion. Thanks!

    Update: Removing the new UI system and using the old one works, but I still would like a solution for the new one.
    Update #2: Managed to reproduce it: https://easyupload.io/z53i4w
     
    Last edited: Apr 1, 2020
  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Sounds like a bug. I would do a bug report using the official tool. They will look into it.

    You could always script a solution using events. Always have the tooltip disappear when popup occurs.
     
    Discipol likes this.
  3. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    83
    I have, but there's always an outside chance I wouldn't hear about it again, or somebody encountered it and did a simple fix. I will never rule out that I am an idiot and I am doing something incredibly obvious but very simple to fix :)