- Home /
Question by
toblerohne12 · Dec 19, 2018 at 09:59 AM ·
scripting problembuttonscript.buttonsbutton trigger events
Unity multiple button on click
Hey guys! I'm really new and could use some help.
I created 3 buttons, and i'd like to give each button different task when it's pressed through 1 script. How could i control this in C#?
untitled.png
(10.6 kB)
Comment
Best Answer
Answer by vJoeyz · Dec 19, 2018 at 10:11 AM
Simply register a click listener on each button with a method reference (delegate) as a parameter.
ButtonOne.onClick.AddListener(TaskOnClick);
Your answer
Follow this Question
Related Questions
Add force when button is pressed 2 Answers
OnClick() animation 0 Answers
How do I remove action listeners from a button without actually clicking the button? 0 Answers
How to make UI button work on HoloLens? 1 Answer
How do i make the perfect button? 1 Answer