Why StopActive() function in Class Sequencer need wait 0.1s than destroy cammand ?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
meichen8050753
Posts: 2
Joined: Fri Feb 15, 2019 4:13 am

Why StopActive() function in Class Sequencer need wait 0.1s than destroy cammand ?

Post by meichen8050753 »

if i wan't play voice with subject's AudioSource, I stop void in OnDestroy to stop voice in before next subtitle (sometimes an other character say something);
But if the same character play voice in two subtitle, A next is B. pre subtitle play A, the next subtitle play B. Beacuse A will wait 0.1s to destoy so that will stop playing voice in B

that is the code

Code: Select all

public void StopActive()
        {
            foreach (var command in m_activeCommands)
            {
                if (command != null)
                {
                    if (!string.IsNullOrEmpty(command.endMessage)) Sequencer.Message(command.endMessage);
                    Destroy(command, 0.1f);
                }
            }
            m_activeCommands.Clear();
        }
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Why StopActive() function in Class Sequencer need wait 0.1s than destroy cammand ?

Post by Tony Li »

Hi,

Are you using the AudioWait() command? If so, it handles this case.
meichen8050753
Posts: 2
Joined: Fri Feb 15, 2019 4:13 am

Re: Why StopActive() function in Class Sequencer need wait 0.1s than destroy cammand ?

Post by meichen8050753 »

In our project, all most sequence custom by ourself to adapt other model,like use cri instead audiosoure。The example I just wan‘t to describing what's problems happend. That problems happens in like move One character in two subtitle and the pre one replace the last.

and more

So I'want konw that has any necessary reason to wait 0.1s before destroy? If not I will remove it in our project reassurly^.^
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Why StopActive() function in Class Sequencer need wait 0.1s than destroy cammand ?

Post by Tony Li »

The 0.1s delay is legacy. I think you can remove the delay and destroy the command immediately. I will be double-checking this for the next release, too. If there are no issues, the next release will not have the 0.1s delay.
Post Reply