Get value of pointerEnter - EventSystem

Hey.
How can i get value of pointerEnter of EventSystem using script?

using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;

public class EventHandler : MonoBehaviour, IPointerEnterHandler {

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
    }

    #region IPointerEnterHandler implementation

    public void OnPointerEnter (PointerEventData eventData)
    {
        UnityEngine.Debug.Log(eventData.pointerCurrentRaycast.gameObject.name); // This is what you want.
    }

    #endregion
}

Hope this helps

1 Like

Thank you for help.

Similar question:

I want to know over what GameObject the pointer is.
In other words, how do I get the info:
PointerEnter: Background (UnityEngine.GameObject) (see screenshot from @Kamil.9132)

Did you find it ?