Hello! I am using destination markers to trigger events in my Unity game. I want to trigger something in Unity when a loop transitions to an adjacent loop, without having that destination marker trigger upon repeating either loop. An example of something that would solve my problem is putting the marker inside a transition region, since it then would only trigger during the transition. Any way of solving the issue would be appreciated. Thanks!
I’m afraid I don’t fully understand what it is you’re trying to do.
You say “I am using destination markers to trigger events in my Unity game.” Do you mean you are using the callback that is fired when the timeline playback position passes a destination marker to trigger events in your game’s code?
Yes, that’s what I’m doing. I want to trigger the event in my code only once, when the loop transitions to the next loop. It doesn’t have to be using destination markers, any method will do.
I’m afraid I still don’t understand the details of the event you’re trying to create.
How are you transitioning between loops? Are you using transition regions, transition markers, or just allowing the timeline playback position to progress along the timeline from one loop to the next? Are transition timelines involved? When you say “loops,” are you using loop regions or instruments with looping behavior?
I am using two loop regions, with no transition timeline between them, where the first loop region has a loop condition of a parameter being less than 1. Once the parameter reaches 1, the loop region deactivates and the playback passes into the second loop region the next time it reaches the end of the first region. The moment it passes into the second loop, I want to trigger a function Foo() in my code.
The issue is that if I use destination marker callbacks, Foo() will trigger multiple times - once every time the second region loops. Is there a way I can send the trigger only once upon the transition from the first loop to the second? Sorry for my inexact language, I’m fairly new to FMOD so I’m not used to the terminology.
Thanks for clarifying your situation.
As of the time of writing (June of 2021), there is no way to make a destination marker callback depend on how the playback position arrives at that destination marker. (It is, however, possible to make a destination marker callback depend on how the playback position leaves that marker: the callback does not fire if there is an active transition marker or loop region end point at the same position as the destination marker when the playback position arrives.)
As such, you will have to use a workaround. I suggest placing another destination marker just before the marker that you want to trigger, and designing your game’s code such that Foo() only triggers if the marker you care about generates a callback immediately after the new destination marker does.