The UI button does not respond to click.

Every time I try to click on the button, nothing happens. I am linking some picks to help everyone answer my question.

I have added a event system. I have a canvas. The button is set to interactable.


2179400--144431--Hierachy.png
2179400--144432--Restart Script.png

Any help please?

remove the ()
Button uses something similar to a SendMessage

Have you double checked your project against the video? The steps in the class should work fine if you follow them exactly. If you are still having trouble, I can double check the details and see what you’ve missed.

It looks like you’ve dragged or selected your script directly from your assets to the onclick of the button rather than from the script attached as a component to the gameobject. I think that’s why you’re only getting the Monoscript.name available to the onclick. You’ll want to drag the script from right below the onclick in the inspector and then you should have the Restart class functions available to use. Although I don’t think you can call static functions from onclick so you’ll have to change that.

A

@OldManAnimal sharp eyes. That makes sense. Thanks for looking more closely.