Page 1 of 1
DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 10:37 am
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!
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 11:38 am
by ds2497
After investigation, it appears that the variable "_subtitle" in ConversationView is null and is causing the problem. I hope this information helps!
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 12:02 pm
by Tony Li
Hi,
I think you found a bug. Try changing that line to:
Code: Select all
if (lastSubtitle != null) NotifyParticipantsOnConversationLineEnd(lastSubtitle)
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 12:24 pm
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?
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 3:51 pm
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;
}
}
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 8:41 pm
by ds2497
Thanks for the help, Tony!
Wish you Merry Christmas!
Re: DialogueSystemEvents problem
Posted: Sun Dec 24, 2023 10:10 pm
by Tony Li
Glad to help! Merry Christmas!