Hey guys,
I have a single Object which has an Audio Source
due to only wanting a single audio to play at a time. Besides that i have various interactables which can be clicked in order to play a sound, meaning clicking an object will tell the game manager which sound he should play… this all works fine so far, however when playing two sounds quickly after another only the second sound gets played, which makes sense since only a single Audio Source
is present I assume.
What I am looking for is a way to queue Audio files in the game Manager and then play these in a row one after another…
I guess whenever I tap an interactable, I would need to add its Audio Clip
to a list, the game manager than plays through the list and deletes the clip from the list once it got played correct ?
But how would you do this ? Using Corountine
s to determine if the Audio Source
is still playing, or rather use PlayScheduled
?
Would be really grateful for some hints and thoughts.
Works like magic, thanks!
– Sweeteningif you use a Queue, don't forget to initialize it with clipsQueue = new Queue<AudioClip>(); or it will not work ¯\\(°_o)/¯
– Andryc