powerfun-unity/Assets/Scripts/UI/ButtonHoverScript.cs

32 lines
732 B
C#
Raw Normal View History

2021-03-25 16:55:36 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class ButtonHoverScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("鼠标悬浮");
gameObject.transform.localScale = new Vector3(1.03f, 1.03f, 1f);
}
public void OnPointerExit(PointerEventData eventData)
{
Debug.Log("鼠标松开");
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}