What's the correct approach for alternating speech bubbles

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DanonBB
Posts: 2
Joined: Fri Oct 21, 2022 5:13 am

What's the correct approach for alternating speech bubbles

Post by DanonBB »

Background: Sometimes i want to display dialogues on big UI in screenspace and sometimes in speech bubbles. When in bubbles, I want every Dialogue entry of a conversation to display in speech bubbles over it's actor's avatar's head.

Current approach: Every character has 2 actors: SampleActor and SampleActor_bubble. Bubble dialogues use "_bubble" versions of the actors. Avatars have an OverrideDialogueUI component with BubbleUI assigned.

Result: Intended dialogues correctly display in a Bubble UI, however all the dialogue entries display in same bubble, over first actor's head.

Tried solutions:

1. Dividing a conversation into multiple conversations every time a speaker changes. Works, but is a nightmare to use.

2. I noticed dialogue UI is only being overriden once, on the conversation start. I tried doing it on every Dialogue Entry instead (with DialogueSystemController.SetConversationUI which I made public), but it didnt work.

3. Tried the same as 2. but insted of DialogueSystemController.SetConversationUI i tried DialogueManager.dialogueUI = myUI, but didn't work neither.

This is how it looks like:

My DialogueUI implementation:

Code: Select all

 private void OnContinueDialogueButtonClicked()
        {
            DialogueEntry currentEntry = DialogueManager.CurrentConversationState.subtitle.dialogueEntry;
            DialogueEntry nextEntry = currentEntry.GetNextEntry();

            if (nextEntry != null)
            {
                int actorID = nextEntry.ActorID;
                string actorName = DialogueManager.masterDatabase.GetActor(actorID).Name;

                var overrideUIBase = DialogueManager.Instance.GetConversationUI(actorName);
                var overrideUI = overrideUIBase as OverrideDialogueUI;

                DialogueManager.dialogueUI = overrideUI.ui.GetComponent<IDialogueUI>();
            }

            OnContinue();
        }
DialogueSystemController extension:

Code: Select all

        public OverrideUIBase GetConversationUI(string actorName)
        {
            var actorGO = SequencerTools.FindSpecifier(actorName, true);
            return FindHighestPriorityOverrideUI(actorGO.transform, null);
        }
I feel like I've wandered into a strange place with my approach, hence I'm asking what's the intended one?
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: What's the correct approach for alternating speech bubbles

Post by Tony Li »

So in the same conversation you want to show some of a character's lines in a screen space UI and other lines in an overhead bubble subtitle panel?

If that's the case, you shouldn't need to use Override Dialogue UI at all. Just assign SampleActor to the dialogue entry nodes that should appear in the screen space UI, and assign SampleActor_bubble to the nodes that should appear in an overhead bubble subtitle panel. SampleActor_bubble's DialogueActor component > Dialogue UI Settings > Custom Subtitle Panel should point to the bubble subtitle panel.

p.s. - To answer your question about changing dialogue UIs mid-conversation, assign the new dialogue UI to DialogueManager.conversationView.dialogueUI.
DanonBB
Posts: 2
Joined: Fri Oct 21, 2022 5:13 am

Re: What's the correct approach for alternating speech bubbles

Post by DanonBB »

No, bubbles and screen space UI don't appear in same conversation, it's either one or another. I just mentioned that there are two types of dialogue to give a context why I'm using OverrideUI for the bubbles.

The problem is, when I have for example 3 bubble actors (A_bubble, B_bubble and C_bubble) in a single conversation, all entries would use A_bubbles's bubble for their lines. I'm trying to make each of them use it's own bubble
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: What's the correct approach for alternating speech bubbles

Post by Tony Li »

Got it. Inspect your conversation (e.g., in the Dialogue Editor window). Make sure each node is assigned to the correct actor. Then make sure each actor has a GameObject with a Dialogue Actor component that specifies the correct actor and the bubble it should use. If that doesn't help, can you send a reproduction project to tony (at) pixelcrushers.com?
Post Reply