Page 1 of 1

Could set a Event In every conversation Line after the sequence?

Posted: Tue Jan 26, 2021 7:39 am
by shortlin
I tried using OnConversationLine(Subtitle subtitle),But it seem happened before the sequence command.

I Want to call a function in every conversationLine. but It must be after the sequence command.Could I do this?Thank you.

Re: Could set a Event In every conversation Line after the sequence?

Posted: Tue Jan 26, 2021 8:27 am
by Tony Li
Hi,
shortlin wrote: Tue Jan 26, 2021 7:39 amI tried using OnConversationLine(Subtitle subtitle),But it seem happened before the sequence command.
This is intentional. It gives OnConversationLine an opportunity to change the sequence before it's played.
shortlin wrote: Tue Jan 26, 2021 7:39 amI Want to call a function in every conversationLine. but It must be after the sequence command.Could I do this?Thank you.
You can wait until the end of the frame:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    StartCoroutine(DoAfterSequence(subtitle));
}

void IEnumerator DoAfterSequence(Subtitle subtitle)
{
    yield return new WaitForEndOfFrame();
    // Code here runs after the sequence has started.
}

Re: Could set a Event In every conversation Line after the sequence?

Posted: Tue Jan 26, 2021 10:39 pm
by shortlin
Thank you!It Works!!

Re: Could set a Event In every conversation Line after the sequence?

Posted: Tue Jan 26, 2021 10:55 pm
by Tony Li
Happy to help!