Hi there!
First of all thank you Tony for all the support. I solved many of my other questions just by searching this forum. I hope this can help some others as well.
I'm setting up a Textline UI dialogue that gets triggered by a button, but I want to be able to open/close the chat box. I wrote a script to try to handle it, but it's creating a lot of duplicate subtitles whenever I open and close again.
Could you help me figure out what's going on? I've tried to implement a few of solutions for similar issues on the forum but I think I'm just a bit nooby at C# and Unity. I recorded a video and included the script. Let me know if there's any other info you need. Thank you very much!
Video:
Script(attached to the NPC obj with Dialogue System Trigger, called by the button object):
Also... please don't hold back on any tips/advice if you think my approach and understanding of DS is way off. Thank you very much!!
Issue with Duplicate Subtitles for Textline UI
Re: Issue with Duplicate Subtitles for Textline UI
Hi,
I'll suggest a different approach.
If you want to temporarily hide the conversation, use the SetDialoguePanel() sequencer command, such as:
and use SetDialoguePanel(true) to show it again.
The TextlineDialogueUI saves the conversation state when you stop a conversation, and it restores the conversation state when you start the conversation again. To stop the conversation and hide the UI, just use DialogueManager.StopConversation(). This will record the current state of the conversation. To resume the conversation, call DialogueManager.StartConversation(...) or use a Dialogue System Trigger.
So this should be all the bits of Dialogue System code you need:
I'll suggest a different approach.
If you want to temporarily hide the conversation, use the SetDialoguePanel() sequencer command, such as:
Code: Select all
// Hide the conversation:
DialogueManager.PlaySequence("SetDialoguePanel(false)");
The TextlineDialogueUI saves the conversation state when you stop a conversation, and it restores the conversation state when you start the conversation again. To stop the conversation and hide the UI, just use DialogueManager.StopConversation(). This will record the current state of the conversation. To resume the conversation, call DialogueManager.StartConversation(...) or use a Dialogue System Trigger.
So this should be all the bits of Dialogue System code you need:
Code: Select all
// Start/resume conversation:
if (DialogueManager.isConversationActive) {
DialogueManager.PlaySequence("SetDialoguePanel(true)");
} else {
dialogueSystemTrigger.OnUse(); // Start conversation, resuming from saved state.
}
Code: Select all
// Temporarily hide conversation:
DialogueManager.PlaySequence("SetDialoguePanel(false)");
Code: Select all
// Stop conversation:
DialogueManager.StopConversation();
Re: Issue with Duplicate Subtitles for Textline UI
Thank you so much Tony! This worked great. Appreciate it!
Re: Issue with Duplicate Subtitles for Textline UI
My pleasure!