Multiple UIs

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
s_marcell
Posts: 5
Joined: Thu Oct 17, 2024 4:35 am

Multiple UIs

Post by s_marcell »

Hi!

I know this has been asked a couple of times but none of the solutions quite match the needs of our setup.

We have very linear (mostly an NPC talking to the player) monolgues with no conversants and no reply options thus there are no actor game objects present in any scene. Conversations are triggered by custom managers throughout the project. We have multiple Dialogue UIs setup for different conversations and it would be nice to be able to choose a UI on the conversation level (e.g.: the conversation properties). Is there any built in way to do so with these circumstances or custom scripting is required to achieve this?

Thanks in advance,

Marcell
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple UIs

Post by Tony Li »

Hi,

We try to keep only basic data types in dialogue databases to make it easier to export & import to external formats. So you can't assign a dialogue UI to a conversation. However, you can pass a dialogue UI along with your DialogueManager.StartConversation() call.

If you do want to associate a dialogue UI with a conversation in your dialogue database (e.g., through the Dialogue Editor), you could create a custom field type that translates a Text field or Number field into a dialogue UI -- for example using a lookup table.
s_marcell
Posts: 5
Joined: Thu Oct 17, 2024 4:35 am

Re: Multiple UIs

Post by s_marcell »

Hi Tony, thanks for the reply.

I stumbled upon the StartConversation overloads and was wondering if the following would be a viable solution:
  • Create a conversation field called "SubtitlePanelIndex"
  • Create a DialogueUI with multiple Subtitle Panels
  • Create an overload of the StartConversation() method that will get the field value for the conversation based on the title and and somehow set the panel as the current panel similar to the sequencer SetPanel command
The problems I found during trying to develop this:
  • I couldn't find a way to get the conversation ID based on the title which is required by DialogueLua.GetConversationField()
  • I couldn't come up with a clean solution to access the subtitle panels
EDIT: I only saw your edits after I posted this, so yeah, that's the direction I've been looking for

Thanks in advance
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple UIs

Post by Tony Li »

Hi,

If you can use different subtitle panels in the same dialogue UI, it might be easier. You wouldn't have to write any code. Use [panel=#] tags or SetPanel() sequencer commands in your conversation.
s_marcell
Posts: 5
Joined: Thu Oct 17, 2024 4:35 am

Re: Multiple UIs

Post by s_marcell »

Tony Li wrote: Thu Oct 17, 2024 10:05 am Hi,

If you can use different subtitle panels in the same dialogue UI, it might be easier. You wouldn't have to write any code. Use [panel=#] tags or SetPanel() sequencer commands in your conversation.
Wouldn't the [panel=#] tag have to be included in all dialogue texts for it to take effect for all entries?
SetPanel() also requires an actor according to the docs
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple UIs

Post by Tony Li »

Yes, [panel=#] is only for individual dialogue entries.

SetPanel() accepts an actor name (that is, an actor in your dialogue database). It doesn't require a GameObject.
s_marcell
Posts: 5
Joined: Thu Oct 17, 2024 4:35 am

Re: Multiple UIs

Post by s_marcell »

Ah ok, makes sense now, thanks you. Thought it had to be a game object. Will try this out!
s_marcell
Posts: 5
Joined: Thu Oct 17, 2024 4:35 am

Re: Multiple UIs

Post by s_marcell »

Hi Tony!

I've encountered a few more issues trying to use SetPanel().

The first was even though I did not set a portrait name on the subtitle panel a null reference was thrown on StandarUISubtitlePanel.cs:733 SetPortraitName(string actorName). Even though no portrait name was assigned in the inspector the null check failed. I added a null check for portraitName.gameObject and that solved the issue.

The second one was even though I used SetPanel(actorName, 1, immediate) at the first entry node of the conversation, both the default and the secondary panels showed up at the same time with the text showing on the default panel, then sometimes continuing on the secondary panel (other times it just keeps using the default one). Am I doing something wrong with the command?

Thanks in advance,

Marcell
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple UIs

Post by Tony Li »

Hi,

Try creating a blank node after <START> that calls those SetPanel() sequencer commands to set the panels the way you want. If you require the player to click a continue button, use "required" in front of the SetPanel() sequencer commands, and include the Continue() command. Example:

Code: Select all

required SetPanel(Player, 0);
required SetPanel(Comedian, 1);
required SetPanel(Heckler, bark);
Continue();
(Or use DialogueManager.StartConversation() or a subclass of DialogueSystemTrigger and specify a different dialogue UI entirely.)
Post Reply