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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
shortlin
Posts: 73
Joined: Wed Jun 03, 2020 1:52 am

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

Post 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.
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
}
shortlin
Posts: 73
Joined: Wed Jun 03, 2020 1:52 am

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

Post by shortlin »

Thank you!It Works!!
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Happy to help!
Post Reply