How to know if AudioSource finished playing without polling the isPlaying() method?

Hi,

Is there anyway a audiosource finished playing a audioclip? It seems the only way to do that is polling the AudioSource.isPlaying() method. I need this because I want to do an action after the sound finish. As an alternative I could use a coroutine with time SoundClip.length as the time limit, but it seems a lot of work just to check if a sound finished (this is used for an Audio manager and could be between 10-20 sounds running every frame).

Is there any other alternative? I was hoping to have a callback delegate or something like that as the notification mechanism :).

The “cleanest” way in my opinion is to use the Invoke function with delay.

The moment you start playing the sound, you should call the Invoke, with as time parameter the SoundClip.length. This way you don’t need a Coroutine that waits, but just a function that will be called after a certain amount of time.

Greetz