Site icon Teaching Newbies since 2014

Unity3D Scripting API #13: OnApplicationQuit() 📱

Unity3D Scripting API

Unity3D Scripting API

Unity Scripting API #13: OnApplicationQuit()📱

⭐ 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);
    }
}
Exit mobile version