Page 1 of 3
FMOD integration how to check if audio finished
Posted: Mon Apr 28, 2025 7:48 am
by Saper
Hi Tony
I want to check if audio was finished. To play audio i use sequence: FMODWait(AudioName, EventProgramerIntrument);
Re: FMOD integration how to check if audio finished
Posted: Mon Apr 28, 2025 9:21 am
by Tony Li
Hi,
You can use regular sequencer messages. For example, to play two FMOD events one after the other:
Code: Select all
FMODWait(firstEvent)->Message(FirstDone);
FMODWait(secondEvent)@Message(FirstDone)
Or to activate GameObject when the FMOD event is done:
Code: Select all
FMODWait(firstEvent)->Message(Done);
SetActive(SomeGameObject)@Message(Done)
Re: FMOD integration how to check if audio finished
Posted: Mon Apr 28, 2025 9:47 am
by Saper
Hi Tony
Is there a posibility to setup something outside dialogue system outside SetActive object?
Re: FMOD integration how to check if audio finished
Posted: Mon Apr 28, 2025 10:16 am
by Tony Li
Sure, you can do anything. That was just an example to demonstrate how to know when FMODWait() is done. What do you want to do?
Re: FMOD integration how to check if audio finished
Posted: Tue May 06, 2025 3:25 am
by Saper
Hi Tony
I want to change variable in one of ours classes
Re: FMOD integration how to check if audio finished
Posted: Tue May 06, 2025 9:41 am
by Tony Li
Hi,
If you write a C# method to access your variables, you can
register it with Lua to call that method in your conversations.
More info:
How To: Connect C# Variables to Dialogue System's Lua
Re: FMOD integration how to check if audio finished
Posted: Wed May 07, 2025 10:44 am
by Saper
After I register my metod, sequence should looks like this?:
Code: Select all
FMODWait(firstEvent)->Message(Done);
MyMetod() @Message(Done)
Re: FMOD integration how to check if audio finished
Posted: Wed May 07, 2025 12:23 pm
by Tony Li
Hi,
If you want to change a variable from within a sequence, don't register your C# method with Lua. (In other words, don't use the instructions I provided in the link above.) Instead, write a
custom sequencer command.
Use Lua functions in Conditions and Script fields. Use sequencer commands in Sequence fields.
Example sequencer command:
Code: Select all
public class SequencerCommandMyMethod : SequencerCommand
{
void Awake()
{
MyClass.Instance.Variable = GetParameterAsInt(0);
Stop();
}
}
Example use:
Code: Select all
FMODWait(firstEvent)->Message(Done);
MyMethod(42)@Message(Done)
Re: FMOD integration how to check if audio finished
Posted: Fri May 16, 2025 9:07 am
by Saper
Hi Tony
Our class is on object, and before the FMOD we used "OnSequenceEnd" for check "if audio finished", with FMOD this don't work by using "OnSequenceEnd" it almost at start set the var to true
Re: FMOD integration how to check if audio finished
Posted: Fri May 16, 2025 11:24 am
by Tony Li
Hi,
If the sequence uses FMODWait(), it should wait until the FMOD event is done before sending the OnSequenceEnd message.
Maybe some other sequence (e.g., some other dialogue entry) is sending OnSequenceEnd.
Can you use the "->Message(Done)" syntax I suggested above?