Issue with Duplicate Subtitles for Textline UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
tengolino
Posts: 5
Joined: Sat Jul 27, 2019 9:33 am

Issue with Duplicate Subtitles for Textline UI

Post by tengolino »

Hi there! :D

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!! :) :)
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with Duplicate Subtitles for Textline UI

Post by Tony Li »

Hi,

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)");
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:

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();
tengolino
Posts: 5
Joined: Sat Jul 27, 2019 9:33 am

Re: Issue with Duplicate Subtitles for Textline UI

Post by tengolino »

Thank you so much Tony! This worked great. Appreciate it! :D :D
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with Duplicate Subtitles for Textline UI

Post by Tony Li »

My pleasure!
Post Reply