Skip to content

Instantly share code, notes, and snippets.

@inertiave
Created September 20, 2019 06:55
Show Gist options
  • Save inertiave/cf8fa49236b55f8e0d402680917c81cc to your computer and use it in GitHub Desktop.
Save inertiave/cf8fa49236b55f8e0d402680917c81cc to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEngine.UI;
public class ButtonBehaviour : MonoBehaviour {
Button button;
void Awake()
{
button = GetComponent<Button>();
button.onClick.AddListener(OnButtonClick);
}
void OnButtonClick()
{
// My Behaviour
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment