Skip to content

Instantly share code, notes, and snippets.

@GOROman
Last active August 29, 2015 14:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GOROman/5cd97be1db54c2cdbe85 to your computer and use it in GitHub Desktop.
Save GOROman/5cd97be1db54c2cdbe85 to your computer and use it in GitHub Desktop.
おお ゆにてい よ、しんでしまうとはなにごとだ!
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
// Unity にザオリク機能を追加します
[InitializeOnLoad]
static class Zaoriku
{
static Zaoriku() {
EditorApplication.playmodeStateChanged += OnPlaymodeChanged;
}
// Playや Pause時に呼ばれる
private static void OnPlaymodeChanged() {
// 再生ボタンおされた??
if (!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode)
{
// おもむろにセーブ
EditorApplication.SaveScene();
Debug.Log( "Saved your life!" );
}
}
}
#endif
@GOROman
Copy link
Author

GOROman commented Jul 27, 2014

ビルド時にエラーになるので

if UNITY_EDITOR

endif

を追加

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment