Ads by ProfitSence

How to end a game in unity Code Example

Last Updated on Wednesday 5th Oct 2022

How to quit the game in Unity (using Application Quit)

  • Quitting the game in Unity can be a very simple task.
  • You can quit a game in Unity by calling the Application.
  • Quit function, which will close a running application.



  • Sometimes You Need to place it inside a public function.
  • It will allow the button to access the quit game method when it’s clicked.
					using UnityEngine;
using System.Collections;

public class AppQuit : MonoBehaviour, IQuittable {
    public void OnQuit() {
        Debug.Log ("AppQuit.Quit");
        Application.Quit ();