
⭐ OnApplicationQuit():
📱 Sent to all GameObjects before the application quits.
📱Called when a user quits the game application✅
📱Called when the play mode is exited from✅
📱OnApplicationQuit() takes no argument
📱 Use cases: saving a player’s score upon quitting the game
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.Log("Start event");
}
void OnApplicationFocus(bool focusState)
{
Debug.Log("The application's focus state is: " + focusState);
}
void OnApplicationQuit(bool quitState)
{
Debug.Log("The application's focus state is: " + quitState);
}
}