I have created a UI Button in unity 2d and it works fine. But I think the event trigger component doesn't work. I want to make the button bigger when the cursor is on the button and return to normal size when the cursor exits it. Here is my script...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayAgainButton : MonoBehaviour
{
public void PointerEnter()
{
Debug.Log("Enter");
transform.localScale = new Vector2(1.2f, 1.2f);
}
public void PointerExit()
{
Debug.Log("Exit");
transform.localScale = new Vector2(1f, 1f);
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
When I play the game, the Console says that the cursor has entered and exited
But the scale of the button never changes.
What is wrong here?
