What's the correct approach for alternating speech bubbles
Posted: Fri Oct 21, 2022 6:14 am
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:
DialogueSystemController extension:
I feel like I've wandered into a strange place with my approach, hence I'm asking what's the intended one?
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();
}
Code: Select all
public OverrideUIBase GetConversationUI(string actorName)
{
var actorGO = SequencerTools.FindSpecifier(actorName, true);
return FindHighestPriorityOverrideUI(actorGO.transform, null);
}