void Awake() { if (clavierGameObj != null) { clavier = clavierGameObj.GetComponent<ClavierHandler>(); } myButton = GetComponent<Button>(); // <-- you get access to the button component here myButton.onClick.AddListener(ChangeClavier); // <-- you assign a method to the button OnClick event here }
void Awake() { if (clavierGameObj != null) { clavier = clavierGameObj.GetComponent <ClavierHandler>(); } myButton = GetComponent <Button>(); // <-- you get access to the button component here myButton.onClick.AddListener(ChangeClavier); // <-- you assign a method to the button OnClick event here }