Created
December 18, 2018 01:34
-
-
Save TsubameUnity/8abd3fc13ddda0caa444724816fb4c80 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
using UnityEngine; | |
using UnityEditor; | |
public class StopExcuteIfHotReloading { | |
[RuntimeInitializeOnLoadMethod] | |
static void StartUp() { | |
EditorApplication.update += EditorUpdate; | |
} | |
static void EditorUpdate() { | |
if (EditorApplication.isPlaying && EditorApplication.isCompiling) { | |
EditorApplication.isPlaying = false; | |
} | |
if (!EditorApplication.isPlaying) { | |
EditorApplication.update -= EditorUpdate; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment