Skip to content

Commit 8028e51

Browse files
committed
Make sure music loops using Play not PlayOneShot
1 parent 2fc034a commit 8028e51

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Assets/_Project/Scripts/Sound/AudioManager.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ void Awake ()
2828
s.source.loop = s.loop;
2929
// default to main mixergroup if not set
3030
s.source.outputAudioMixerGroup = s.mixerGroup ? s.mixerGroup : mixerGroup;
31+
32+
Debug.Log (s.name.ToString () + ", " + s.loop.ToString ());
3133
}
3234

3335

@@ -55,7 +57,11 @@ public void Play (string sound)
5557
s.source.volume = s.volume * (1f + UnityEngine.Random.Range (-s.volumeVariance / 2f, s.volumeVariance / 2f));
5658
s.source.pitch = s.pitch * (1f + UnityEngine.Random.Range (-s.pitchVariance / 2f, s.pitchVariance / 2f));
5759

58-
s.source.PlayOneShot (s.source.clip);
60+
if (sound == "music")
61+
s.source.Play ();
62+
else
63+
s.source.PlayOneShot (s.source.clip);
64+
5965
}
6066

6167

0 commit comments

Comments
 (0)