private void StopClip() { if (CurrentlyPlayingCoroutine != null) { RuntimeHelper.StopCoroutine(CurrentlyPlayingCoroutine); } Source.Stop(); CurrentlyPlaying = null; CurrentlyPlayingCoroutine = null; playStopButton.ButtonText.text = "Play Clip"; ResetProgressLabel(); }
private IEnumerator PlayClipCoroutine() { playStopButton.ButtonText.text = "Stop Clip"; CurrentlyPlaying = this; Source.clip = this.RefAudioClip; Source.Play(); while (Source.isPlaying) { progressLabel.text = $"{GetLengthString(Source.time)} / {fullLengthText}"; yield return(null); } CurrentlyPlayingCoroutine = null; StopClip(); }