static void Update() { #if !UNITY_2017_2_OR_NEWER // Compilation will cause scripts to reload, losing all state // This is the last chance to clean up FMOD and avoid a leak. if (EditorApplication.isCompiling) { DestroySystem(); RuntimeManager.Destroy(); } #endif // Update the editor system if (system.isValid()) { CheckResult(system.update()); } if (previewEventInstance.isValid()) { FMOD.Studio.PLAYBACK_STATE state; previewEventInstance.getPlaybackState(out state); if (previewState == PreviewState.Playing && state == FMOD.Studio.PLAYBACK_STATE.STOPPED) { PreviewStop(); } } }