Page 1 of 1

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

Posted: Thu Sep 19, 2019 5:43 am
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();
        }

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

Posted: Thu Sep 19, 2019 10:58 am
by Tony Li
Hi,

Are you using the AudioWait() command? If so, it handles this case.

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

Posted: Thu Sep 19, 2019 10:26 pm
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^.^

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

Posted: Fri Sep 20, 2019 10:09 am
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.