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.
however it plays hoveron when the scene starts and i cant get hoveroff to play at all, anybody know a fix?
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");
}
}
