Skip to content

Instantly share code, notes, and snippets.

@suakig
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suakig/90c2e46827834385d76c to your computer and use it in GitHub Desktop.
Save suakig/90c2e46827834385d76c to your computer and use it in GitHub Desktop.
EndMonoBehaviourSample.cs
using UnityEngine;
using System.Collections;
public class EndMonoBehaviourSample : EndMonoBehaviour
{
private Hashtable table = new Hashtable();
private void Start()
{
iTween.MoveTo(gameObject, iTween.Hash("x", 20, "looptype", iTween.LoopType.loop));
Invoke ("make", 0.1f);
//Destroy(this.gameObject, 1.0);
//で削除すると、削除途中に終了した時、OnApplicationQuitが呼ばれない
//また、非アクティブ状態のまま終了した場合も呼ばれない
Invoke ("delete", 1.0f);
iTween.Pause ();
}
void make()
{
GameObject ga = new GameObject ();
ga.AddComponent(this.GetType());
}
void delete()
{
Destroy (this.gameObject);
}
protected override void OnDisableNotApplicationQuit()
{
Debug.Log ("OnDisableNotApplicationQuit");
}
protected override void OnDestroyNotApplicationQuit()
{
iTween.Stop (this.gameObject);
Debug.Log ("OnDestroyNotApplicationQuit");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment