Created
May 9, 2015 07:46
-
-
Save suakig/5c47ec24717f73f7d98f to your computer and use it in GitHub Desktop.
EndMonoBehaviour.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class EndMonoBehaviour : MonoBehaviour | |
{ | |
bool isApplicationQuit = false; | |
private void OnApplicationQuit() | |
{ | |
isApplicationQuit = true; | |
} | |
private void OnDisable() | |
{ | |
if (isApplicationQuit) { | |
return; | |
} | |
OnDisableNotApplicationQuit (); | |
} | |
private void OnDestroy() | |
{ | |
if (isApplicationQuit) { | |
return; | |
} | |
OnDestroyNotApplicationQuit (); | |
} | |
protected virtual void OnDisableNotApplicationQuit (){} | |
protected virtual void OnDestroyNotApplicationQuit (){} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment