I am taking an online course in Unity. The game we are making uses premade scripts. I can’t get my quit button to work to end the game on either level. I have a GameOver canvas with a quit button, and the text on the button points to the quit game script, and the canvas is set to interactable, and points to the end game text and the correct script. No one else seems to be having this problem, and no one has answered my help request in the class message boards, so I am turning here for help.
Edited to add: it doesn’t work in either the preview or after I build it.
I don’t know how to do code - we learn how to use it next lesson. Basically, we were told to select a prewritten code from the provided scripts folder. I did see some answers to similar problems, but I haven’t yet learned what to do with the provided pieces of code.
It wouldn’t let me upload another picture to show the code, so I cut and pasted it (but I don’t think that’s the problem):
using UnityEngine;
using System.Collections;
public class UIButtonQuitGame : MonoBehaviour {
public void quitGame()
{
//Closes the game
Application.Quit();
}
}