Version: 2017.2

Selectable.OnPointerEnter

切换到手册
public void OnPointerEnter (EventSystems.PointerEventData eventData);

参数

eventData 通常由 EventSystem 发送的 EventData。

描述

评估当前状态并过渡至适当状态。

新状态可能为按下或悬停(取决于按下状态)。

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;// Required when using Event data.

public class ExampleClass : MonoBehaviour, IPointerEnterHandler// required interface when using the OnPointerEnter method. { //Do this when the cursor enters the rect area of this selectable UI object. public void OnPointerEnter(PointerEventData eventData) { Debug.Log("The cursor entered the selectable UI element."); } }