Search Unity

Event trigger detection

Discussion in 'UGUI & TextMesh Pro' started by Nicholas1010, Jul 20, 2016.

  1. Nicholas1010

    Nicholas1010

    Joined:
    Aug 2, 2014
    Posts:
    20
    So its hard to explain but...

    I am trying to make some kind of dynamic UI instantiated and customized by a C# script.

    I have (deactivated, which gets activated later as more of them instantiates) prefab UI panel with some text in it, and script then instantiates more of those and they all have same event triggers. So basically what I am trying to do is, whichever gets pointer enter event, color it (kinda highlight it with color) orange, and problem is, I am not sure how to detect it to color it, like, how to get it.

    So how do I get triggered object so I can highlight it?

    Sorry if I missed anything was kind of in a hurry writing this.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Nicholas1010

    Hi, not sure what you are doing - seeing code might help... so I'm guessing.

    "whichever gets pointer enter event" - I think you answered your question yourself.

    Make a class that implements IPointerEnterHandler, and add your logic to OnPointerEnter Method that is required by IPointerEnterHandler?