DialogueSystemEvents problem

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

DialogueSystemEvents problem

Post by ds2497 »

Hi Tony,

I'm experiencing an issue where the first line of the conversation doesn't trigger the "On Conversation Line End (Subtitle)" event in DialogueSystemEvents. I'm using a script to manage the visibility of my custom Continue Button, specifically for fast-forwarding Bark conversations. It seems that "On Conversation End" is not triggered after the first line, and it gets triggered one extra time after the conversation concludes. Any insights on this? Thanks!

Image

Image

Image
Last edited by ds2497 on Sun Dec 24, 2023 11:46 am, edited 1 time in total.
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: DialogueSystemEvents problem

Post by ds2497 »

After investigation, it appears that the variable "_subtitle" in ConversationView is null and is causing the problem. I hope this information helps!

Image
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueSystemEvents problem

Post by Tony Li »

Hi,

I think you found a bug. Try changing that line to:

Code: Select all

if (lastSubtitle != null) NotifyParticipantsOnConversationLineEnd(lastSubtitle)
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: DialogueSystemEvents problem

Post by ds2497 »

Tony Li wrote: Sun Dec 24, 2023 12:02 pm Hi,

I think you found a bug. Try changing that line to:

Code: Select all

if (lastSubtitle != null) NotifyParticipantsOnConversationLineEnd(lastSubtitle)
Cool! The "On Conversation End" finally got triggered! However, it didn't resolve the second issue. I'm trying to change the text on the continue button from "Continue" to "Finish Conversation" right after the final line of the conversation is played(RefreshContinueButtonText). Currently, it seems that "On Conversation End" is triggered twice when the last line is played. The outcome of my code is that the final line doesn't display "Finish Conversation" when it plays but it does appear when the conversation is over. Any thoughts?

Image
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueSystemEvents problem

Post by Tony Li »

Hi,

OnConversationEnd only happens once at the end of the conversation. If you want to get to the bottom of the issue, check that you're not connecting it to more than one UnityEvent.

However, to accomplish what you want, use an OnConversationLine(Subtitle) method to change the continue button's text instead. Example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class ManageContinueButtonLabel : MonoBehaviour
{
    public UITextField label; //<-- ASSIGN IN INSPECTOR
    public string txtContinue = "Continue";
    public string txtEndConversation = "End Conversation";
    
    void OnConversationLine(Subtitle subtitle)
    {
        label.text = DialogueManager.currentConversationState.hasAnyResponses ? txtContinue : txtEndConversation;
    }
}
User avatar
ds2497
Posts: 55
Joined: Wed Jun 14, 2023 2:13 am

Re: DialogueSystemEvents problem

Post by ds2497 »

Thanks for the help, Tony!

Wish you Merry Christmas!
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: DialogueSystemEvents problem

Post by Tony Li »

Glad to help! Merry Christmas!
Post Reply