Recommended setup for multiple UIs (in-person + call)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
visiblenoise
Posts: 3
Joined: Sat Sep 14, 2024 1:28 pm

Recommended setup for multiple UIs (in-person + call)

Post by visiblenoise »

TLDR: Trying to swap dialogue UI based on a conversation's custom field before it starts, regardless of how it starts. Is it possible? Is there a better way?

I'll explain why I'm trying to do that, and my current attempt.

I'm trying to set up two default modes of conversation, a regular in-person one and a call mode like the codec from the Metal Gear series. Another wrinkle is that I don't think the call mode UI should be done through a UI prefab - that UI will have multiple functions apart from the calling (think Fallout's Pip-Boy), so the plan is to keep it loaded additively in its own scene.

I started thinking it would be nice to only have to specify in the conversation editor whether it is a regular one or a call, instead of remembering to add an Override Dialogue UI somewhere every time a call conversation is being set up. I've already figured out how to add/read a custom bool to the conversations.

Then I looked for a way to call DialogueManager.UseDialogueUI() before any conversation was triggered (based on the conversation's custom bool), but I couldn't find any. I know of the OnConversationStart message, but at that point I think DialogueManager has already loaded the UI and started the conversation, so swapping the UI there didn't seem to work.

With my current attempt, I have a version of StandardDialogueUI that is a composite of two AbstractDialogueUIs (for in-person and for calling). I think with enough work I can figure it out, but so far it doesn't seem too straightforward, and it makes me wonder if my approach is wrong.
User avatar
Tony Li
Posts: 21634
Joined: Thu Jul 18, 2013 1:27 pm

Re: Recommended setup for multiple UIs (in-person + call)

Post by Tony Li »

Hi,

How are you starting the conversation?

If you're using a Dialogue System Trigger, here are two options:

1. Assign a dialogue UI to the Dialogue System Trigger's Actions > Start Conversation > Override Dialogue UI field.

2. Or make a subclass of DialogueSystemTrigger and override the DoConversation() method. Before running the base method, check which UI you want to use, and set overrideDialogueUI.
visiblenoise
Posts: 3
Joined: Sat Sep 14, 2024 1:28 pm

Re: Recommended setup for multiple UIs (in-person + call)

Post by visiblenoise »

Tony Li wrote: Sat Sep 14, 2024 10:04 pm Hi,

How are you starting the conversation?

If you're using a Dialogue System Trigger, here are two options:

1. Assign a dialogue UI to the Dialogue System Trigger's Actions > Start Conversation > Override Dialogue UI field.

2. Or make a subclass of DialogueSystemTrigger and override the DoConversation() method. Before running the base method, check which UI you want to use, and set overrideDialogueUI.
Hey Tony, really appreciate the quick response!

I would have preferred a more set-and-forget option, but option #2 will work. We'll primarily be using DialogueSystemTrigger. Initially I was reluctant to use a custom component over a known standard one for the trigger, especially because I'm not solo and the rest of my team will also have to remember to use it every time. But upon reflection this probably isn't a big deal.

Thanks!
User avatar
Tony Li
Posts: 21634
Joined: Thu Jul 18, 2013 1:27 pm

Re: Recommended setup for multiple UIs (in-person + call)

Post by Tony Li »

Hi,

Sounds good. DialogueSystemTrigger's methods are virtual for this very reason.

However, another option -- along the Pip-Boy line of thinking -- is to always use your Pip-Boy equivalent as the conversation conversant. After all, that's what the player is conversing through. Use an Override Dialogue UI component on the Pip-Boy. But then use a third actor for the NPC you're actually talking to through the Pip-Boy.
visiblenoise
Posts: 3
Joined: Sat Sep 14, 2024 1:28 pm

Re: Recommended setup for multiple UIs (in-person + call)

Post by visiblenoise »

Your last suggestion is closest to the sort of thing I was hoping for and it seems to be working out. Now I also don't need to have a custom bool in the conversation. You've thought of everything!

I think this option crossed my mind while going through the docs and forums, but assigning something other than the actual dialogue partner to "conversant" made me nervous.
User avatar
Tony Li
Posts: 21634
Joined: Thu Jul 18, 2013 1:27 pm

Re: Recommended setup for multiple UIs (in-person + call)

Post by Tony Li »

Assigning other actors is totally fine. And once you assign an extra actor to a dialogue entry node, then when you create child nodes they'll alternate between that actor and the listener, so you don't have to constantly assign the third actor to new nodes. You can also hold Shift while right-clicking and selecting Add Child Node to add a new node with the same actor & conversant instead of flipping them.
Post Reply