I’m trying to create a script the runs the Application.Quit() function when a UI button is clicked, but I seem to be unable to reference said button in the Hierarchy. I’m attempting to reference the “Exit” button. I used the code:
if (Canvas.Exit)
{
Application.Quit();
}
My hierarchy is structured as:
-
Main Camera
-
Directional light
-
Canvas
-
PauseMenu
-
PauseInspector
-
Video Settings
-
Audio Settings
-
Exit // Button I want to reference
-
Text
-
EvenSystem