using UnityEngine;
using UnityEngine.UI;
public class Example : MonoBehaviour
{
public Button button;
private void Start()
{
button.onClick.AddListener(OnClick);
}
private void OnClick()
{
Debug.Log("Click");
}
}