# Knowing when a Loop region is over

**URL:** <https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [September 23, 2021, 3:55pm UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706 "2021-09-23T15:55:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego687](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@Diego687](https://qa.fmod.com/u/Diego687)\
**Post date:** [September 23, 2021, 3:55pm UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706/1 "2021-09-23T15:55:02Z")

</div>

Hello, I have a single track that has a paramter and a looping region. I would like to keep looping the region for some time. Once that time is over I change the parameter to transition towards the next part of the track. Everything’s working except that I don’t know how to get that the looping region ended. I want to trigger an animation after the looping ends but I can’t find a way to get that information.

---

<div class="post-metadata">

**Author:** ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)\
**Post date:** [September 23, 2021, 9:57pm UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706/2 "2021-09-23T21:57:54Z")

</div>

If I understand correctly, when the time is over, the parameter switch deactivates the loop, so the playback can follow through the next part (but without jump-transitioning). And you want to know when the looping part is finished.

I think the way to go is to put a marker just after the looping region, and set a callback in your game code. Use [FMOD\_STUDIO\_EVENT\_CALLBACK\_TIMELINE\_MARKER](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventinstance.html#fmod_studio_event_callback_type)

Another method (less clean!) is to put a command instrument just after the looping region, to set a specific parameter to a specific value, and loop/check this parameter value in your game code.

Or also, you can loop/check the timeline position with [get timeline position](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventinstance.html#studio_eventinstance_gettimelineposition).

---

<div class="post-metadata">

**Author:** ![Diego687](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@Diego687](https://qa.fmod.com/u/Diego687)\
**Post date:** [September 23, 2021, 10:54pm UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706/3 "2021-09-23T22:54:03Z")

</div>

Hello, Thank you for your quick response. This seems to be exactly what I was looking for. I’m gonna do some research to use the callback event.

I was using the timeline position but thought that was kinda bad. Glad to know I can do it with a callback.

---

<div class="post-metadata">

**Author:** ![adarsh92](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@adarsh92](https://qa.fmod.com/u/adarsh92)\
**Post date:** [January 30, 2024, 11:36am UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706/4 "2024-01-30T11:36:06Z")

</div>

Hello,  
This is a follow up on the same question I have. I wanted to know if Fmod has a callback to know when a loop region is over.  
The reason I need this is I want to add a counter to check how many times the loop region has looped for and then depending on that do some actions.

---

<div class="post-metadata">

**Author:** ![joseph](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/joseph/32/264_2.png) [@joseph](https://qa.fmod.com/u/joseph)\
**Post date:** [January 31, 2024, 3:18am UTC](https://qa.fmod.com/t/knowing-when-a-loop-region-is-over/17706/5 "2024-01-31T03:18:47Z")

</div>

> [@adarsh92](#):
>
> This is a follow up on the same question I have.

As mentioned in earlier posts in this thread, there is no callback that fires when a loop region ends, but you can place a destination marker anywhere within the loop and use [FMOD\_STUDIO\_EVENT\_CALLBACK\_TIMELINE\_MARKER](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventinstance.html#fmod_studio_event_callback_type) to know when the playback position passes that marker. That should give you the information you need to make your counter work.
