com.tunnelsnakes.audiosystem 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  using System;
2
2
  using System.Collections;
3
3
  using System.Collections.Generic;
4
+ using UnityEditorInternal;
4
5
  using UnityEngine;
5
6
 
6
7
  [ExecuteAlways]
@@ -102,10 +103,15 @@ public class AudioPresenter : MonoBehaviour {
102
103
 
103
104
  private IEnumerator WaitForEnd() {
104
105
  var time = new WaitForFixedUpdate();
105
- while (_audioSource.isPlaying || ((_audioSource.timeSamples != 0) && (_audioSource.timeSamples != _audioSource.clip.samples))) { //Ended or stopped, not paused
106
-
107
- yield return time;
108
- }
106
+ //while (_audioSource.isPlaying || ((_audioSource.timeSamples != 0) && (_audioSource.timeSamples != _audioSource.clip.samples))) { //Ended or stopped, not paused
107
+ // yield return time;
108
+ //}
109
+ bool isPlayingInPrevFrame, isPlaying = false;
110
+ do {
111
+ isPlayingInPrevFrame = isPlaying;
112
+ isPlaying = _audioSource.isPlaying || ((_audioSource.timeSamples != 0) && (_audioSource.timeSamples != _audioSource.clip.samples));
113
+ yield return time;
114
+ } while (isPlaying || isPlayingInPrevFrame);
109
115
  Stop();
110
116
  }
111
117
 
packages/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.tunnelsnakes.audiosystem",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "displayName": "TS AudioSystem",
5
5
  "description": "Audio and vibrations",
6
6
  "license": "proprietary",