- Home /
Button OnClick() Missing Code Error, How do I fix this?
I'm working on an application that requires me to use the unity UI button. I've been trying to connect a method to the OnClick() function that's built into the button interface, but so far all I got is a message that said "" and the button have no functionality. Can someone tell me what's going on here and how do I fix this? Thank you.
Answer by CrazyMonoJunior · Jun 27, 2017 at 08:52 PM
Okay I've found the solution to my problem. I made the onClick() method static in the code, after removing the "static" the onClick() method was able to find the method and everything went well.
Your answer
![](https://koobas.hobune.stream/wayback/20220612125017im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to improve device heating (Android) 1 Answer
UI Text won't appear at all. 1 Answer
How to detect button presses and change child object text in the button's Parent Object script 0 Answers
Icons appear pixel perfect in editor but not in build 1 Answer
Unity 2D 4.6b UI: Why are instantiated prefab sprites rendering over UI elements? 1 Answer