
⭐ OnDisable()
🛡️Called whenever the script component is disabled 🛡️ Also called when a game object is destroyed. When you quit your game, the scripts (which are game objects) are destroyed and this triggers the OnDisable() event method
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");
}
void Update()
{
}
void OnDisable()
{
Debug.Log("On Disable");
}
}