using UnityEngine; public class SimulationModel : MonoBehaviour { private bool isQuitting = false; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } // Update is called once per frame void Update() { } private void OnEnable() { DataManager.I.AddModel(this); } private void OnDisable() { if (isQuitting) return; DataManager.I.RemoveModel(this); } void OnApplicationQuit() { isQuitting = true; } }