static ROSMonoBehavior() { rosmanager = new ROSManager(); #if UNITY_EDITOR UnityEditor.EditorApplication.playmodeStateChanged = () => { string state = ""; if (EditorApplication.isPlaying) { state += "playing"; } if (EditorApplication.isPaused) { state += " paused"; } if (EditorApplication.isCompiling) { state += " compiling"; } state = state.Trim(' '); Debug.LogWarning("PlayMode == " + state); if (!EditorApplication.isPlaying && !EditorApplication.isPaused) { ROS.Unfreeze(); if (ROS.ok || ROS.isStarted()) { ROSManager.StopROS(); } } else if (EditorApplication.isPlaying) { if (!EditorApplication.isPaused) { ROS.Unfreeze(); rosmanager.StartROS(null, null); } else { ROS.Freeze(); } } }; #endif }