[英]Unity - deleting a specific gameobject when mouse/pointer is over it
[英]Unity button hover animation plays when the scene starts, not when the mouse pointer is over the gameobject
ive made a hoveron and hoveroff animation which when the mouse pointer is over the button (hovering) it slides the button out slightly to the left, and hover off the opposite animation where it slides back to its original position.
但是当场景开始时它会播放悬停,我根本无法播放悬停,有人知道解决方法吗?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class hoverscript : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public RectTransform NewGameMenuButton;
// Start is called before the first frame update
void Start()
{
NewGameMenuButton.GetComponent<Animator>().Play("Hover Off");
}
public void OnPointerEnter(PointerEventData eventData)
{
NewGameMenuButton.GetComponent<Animator>().Play("Hover On");
}
public void OnPointerExit(PointerEventData eventData)
{
NewGameMenuButton.GetComponent<Animator>().Play("Hover Off");
}
}
好的解决方法是我没有拖动脚本上的按钮 IM STUPID SORRY!!!!!!!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.