Last active
August 29, 2015 14:04
-
-
Save GOROman/5cd97be1db54c2cdbe85 to your computer and use it in GitHub Desktop.
おお ゆにてい よ、しんでしまうとはなにごとだ!
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
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ビルド時にエラーになるので
if UNITY_EDITOR
endif
を追加