Unity UGUI 鼠标悬停一段时间显示Text文字
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ShowBuildProperty : MonoBehaviour ,IPointerEnterHandler, IPointerExitHandler
{
public Text BlocksProperty; // 详细信息;
[SerializeField]
private float timer; // 计时器;
private bool isCanTimer;
public float DelayTime; // 悬停时间;
private void Start()
{
timer = 0f;
DelayTime = 0.5f;
BlocksProperty = GameObject.Find("BlocksProperties").GetComponent();
}
public void OnPointerEnter(PointerEventData eventData)
{
timer = 0f;
isCanTimer = true;
BlocksProperty.text = this.gameObject.name + "\n\r" + "