- Home /
Unity UI Button not working
I have a button under a canvas that is suppose to restart the scene. But instead its not calling the intended function of attached script.
On Unity Forums, I found solutions like it should be at higher hierarchy in canvas, and the canvas should have a graphic raycast and so-on.
But it still isn't working, although its on click array detects the intended method it is suppose to call.
using UnityEngine;
using UnityEngine.Scene$$anonymous$$anagement;
public class RestartGameScript : $$anonymous$$onoBehaviour
{
public void RestartGame()
{
Scene$$anonymous$$anager.LoadScene(0);
}
}
Answer by Gamesearch · Apr 07, 2016 at 07:00 PM
Have you set the RestartGame() in the Button On Click() Component from the UI Button?
Your answer
Follow this Question
Related Questions
On Button Click Enable - Disable GameObject Through Inspector 1 Answer
Button is not being clicked. 1 Answer
Unity 4.6's button Bug? 1 Answer
AddListener not working c# 0 Answers
UI Button: one action after other with only one click 1 Answer