12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using UnityEngine;
- using UnityEngine.Events;
- public class StartDestroyEventObject : MonoBehaviour
- {
- private void Start()
- {
- if (this.m_EventOnStart != null)
- {
- this.m_EventOnStart.Invoke();
- }
- }
- private void OnDestroy()
- {
- if (this.m_IsQuittingApplication)
- {
- return;
- }
- if (this.m_EventOnDestroy != null)
- {
- this.m_EventOnDestroy.Invoke();
- }
- }
- private void OnApplicationQuit()
- {
- this.m_IsQuittingApplication = true;
- }
- public UnityEvent m_EventOnStart;
- public UnityEvent m_EventOnDestroy;
- private bool m_IsQuittingApplication;
- }
|