'BarkString', but using the Dialogue UI.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DarkProphet
Posts: 15
Joined: Thu Dec 16, 2021 2:09 pm

'BarkString', but using the Dialogue UI.

Post by DarkProphet »

Is there a way to use the normal dialogue UI to 'bark' a one-off custom string?
Basically, instead of using StartConversation(title)
you would have BarkConversation(customString, dialogueActor)
or something like that.
Is there functionality for this built in - or can someone help me write some code to make it possible?
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 'BarkString', but using the Dialogue UI.

Post by Tony Li »

Hi,

You can manually open the dialogue UI, make a subtitle object, and show it. For example:

Code: Select all

DialogueManager.standardDialogueUI.Open();
PixelCrushers.DialogueSystem.CharacterInfo speakerInfo = new PixelCrushers.DialogueSystem.CharacterInfo(2, "NPC", null, CharacterType.NPC, null);
PixelCrushers.DialogueSystem.CharacterInfo listenerInfo = new PixelCrushers.DialogueSystem.CharacterInfo(1, "Player", null, CharacterType.PC, null);
FormattedText formattedText = FormattedText.Parse("Hello world");
string sequence = "Delay(2)";
string responseMenuSequence = string.Empty;
DialogueEntry dialogueEntry = null;
Subtitle subtitle = new Subtitle(speakerInfo, listenerInfo, formattedText, sequence, responseMenuSequence, dialogueEntry);
DialogueManager.standardDialogueUI.ShowSubtitle(subtitle);
yield return new WaitForSeconds(2);
DialogueManager.standardDialogueUI.Close();
DarkProphet
Posts: 15
Joined: Thu Dec 16, 2021 2:09 pm

Re: 'BarkString', but using the Dialogue UI.

Post by DarkProphet »

Ok cool! I'll look into this.
Thanks a bunch!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 'BarkString', but using the Dialogue UI.

Post by Tony Li »

Glad to help!
Post Reply