- Home /
Adding EventTrigger listeners through code
A recent change in my project means i can no longer use the scene to add events. I used the example below to add functionality to my buttons:
var button = transform.Find("Remove").GetComponent<Button>();
button.onClick.AddListener(() => rowController.RemoveRow());
I wanted my input field to trigger when the user goes to the next field so i added an EventTrigger component to that and used Deselect() which worked well (let me know if there is a better way).
But i cannot work out how to add Deselect as it says it is a void type when i try to use the same format as the button code.
Comment
Your answer