Execute some script after clicking on disabled button
Hi Guys,
I am pretty new to Unity and facing a blocker.
Have a button prefab. Creating multiple buttons using the prefab and marking few of them as interactable = false.
OnClick() is called for all buttons were interactable = true and not called if interactable = false.
Now need to execute script if button as interactable = false is clicked.
The reason I am disabling buttons is because I don't want it text to be changed.
How this can be achieved?
Thank you.
Answer by unity_xwP0uy_2pcdsnw · Jun 27, 2020 at 10:09 AM
Finally got the solution. Removed interactable = false from code. Instead added a flag, and according to flag value executed the functionality.
Your answer
![](https://koobas.hobune.stream/wayback/20220613000310im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
clicking button using script? 1 Answer
Button Help 1 Answer
Change button to work OnPress instead of OnClick? 1 Answer
Script being autorun on start instead of button click. 2 Answers
Name of button on click 1 Answer