Search Unity

OnPointerEnter events blocking buttons from highlighting/triggering

Discussion in 'UGUI & TextMesh Pro' started by stregillus, Jan 29, 2017.

  1. stregillus

    stregillus

    Joined:
    Oct 9, 2016
    Posts:
    10
    I have a canvas element and I want to do something specific when I mouse over the entire canvas. I essentially enable a specific script when the pointer is entered.

    I have tried creating a script that implements IPointerEnterHandler and IPointerExitHandler and then putting the following:

    public void OnPointerEnter(PointerEventData data)
    {

    myscript.enabled = true;
    }

    public void OnPointerExit(PointerEventData data)
    {

    myscript.enabled = false;
    }

    This works great! The script gets enabled and disabled as expected... BUT as long as the script that implements IPointerEnterHandler is enabled, all of the BUTTONS that are on that canvas stop working. Hovering over them doesn't highlight the button. If I disable the IPointerEnterHandler script, the button starts working normally as expected and is highlighting properly.

    The same thing happens if I add event triggers for OnPointerEnter and OnPointerExit instead of implementing the handler interfaces.

    It seems like the pointer event is getting "eaten" by the script on the canvas - how can I prevent this?
     
    musickgm likes this.
  2. stregillus

    stregillus

    Joined:
    Oct 9, 2016
    Posts:
    10
  3. musickgm

    musickgm

    Joined:
    Mar 19, 2016
    Posts:
    15
    Any news on this?