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.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityEvery 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.
The problem is here:
it looks like you directly dropped the script instead of the object to which it is attached.
Let's say your "Restart" script is attached to MainCamera. You need to assign Main Camera in the field marked red.Then select a script attached to main Camera, which is Restart, from that select a method which is ReStartGame().
When you do that, the field marked green would say: Restart.RestartGame
Put the Debug.Log before the Loadlevel instruction. What happens now is, LoadLevel is executed and everything is destroyed, including the button which was clicked. When new scene is loaded, everything in current scene is automatically destroyed. If you want an object to be present across multiple scenes, check the manual for DontDestroyOnLoad().