# Wait for dialog line to be finished then trigger next one

**URL:** <https://qa.fmod.com/t/wait-for-dialog-line-to-be-finished-then-trigger-next-one/14425>\
**Category:** Unity\
**Created:** [March 8, 2019, 8:00pm UTC](https://qa.fmod.com/t/wait-for-dialog-line-to-be-finished-then-trigger-next-one/14425 "2019-03-08T20:00:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhinoceroz](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@rhinoceroz](https://qa.fmod.com/u/rhinoceroz)\
**Post date:** [March 8, 2019, 8:00pm UTC](https://qa.fmod.com/t/wait-for-dialog-line-to-be-finished-then-trigger-next-one/14425/1 "2019-03-08T20:00:33Z")

</div>

I’m working on dialog. I would like a line of dialog to play, then the next line of dialog waits for the previous line to be completed, then plays. Right now I’m just doing playoneshot, and wait for x number of seconds, then trigger the next line. But I would rather have the lines of dialog trigger each other instead. Thanks

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [March 13, 2019, 1:43am UTC](https://qa.fmod.com/t/wait-for-dialog-line-to-be-finished-then-trigger-next-one/14425/2 "2019-03-13T01:43:14Z")

</div>

It would be better to create your own function to handle this situation.

Create the `EventDescription` of your dialogue event and use `EventDescription::getInstanceCount()` to see how many instances are playing. Once the number of instances reaches 0 then the instance of that event has finished and you can start your next one.

[https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD\_Studio\_EventDescription\_GetInstanceCount.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_Studio_EventDescription_GetInstanceCount.html#/)

If you’re using Programmer Instruments, you can check for the callback of if the programmer sound has been destroyed or if the event has stopped in order to start the next one.

[https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD\_STUDIO\_EVENT\_CALLBACK.html#/](https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_STUDIO_EVENT_CALLBACK.html#/)
