private void OnDisable() { if (_stopOnDisable) { StopCoroutine(_coroutine); _handle.Stop(); } }
private static IEnumerator StopAfterInternal(AudioHandle handle, float time) { #if EDITOR_COROUTINES && UNITY_EDITOR if (!Application.isPlaying) { yield return(new EditorWaitForSeconds(time)); } else { yield return(new WaitForSeconds(time)); } #else yield return(new WaitForSeconds(time)); #endif handle.Stop(0); }
private static async UniTask StopAfterInternal(AudioHandle handle, float time) { await UniTask.Delay((int)(time * 1000)); handle.Stop(0); }