Button of the UI not showing any functions in the On Click()

Hello,
I just suddenly encountered this problem. No matter what script I assign to this button, it doesn’t give me any functions’ option.
What might be the cause of it?

Here:

You have to add the script to a Game Object, assign that Game Object to the OnClick() and then you’ll see the methods from that script in there. Hope this helps!

1 Like

Hii, there is a game object with the associated scrpit that makes the program work already :sweat_smile:

I meant there for the OnClick, I highlighted in red. It shows a script, not a Game Object if I can see it correctly. I tried it here and got the same result as you.

1 Like

Ohhhh it works as you suggested! Thank youuuu:smile::smile:

Really? What a “rear-end to elbow” solution. Is there any particular logic to this? Quite honestly, this is such a confusing path that I’ve searched and searched and only by stupid chance came upon this thread.

We’re in the process of developing UI Toolkit to be a better solution for runtime UI, but this has been the case for UGUI for a long time now, so sorry you had so much trouble finding a solution to your issue! If you check the content in Unity Learn you can probably find many different examples of this.