Dialogue Override multiple UI''s

Announcements, support questions, and discussion for the Dialogue System.
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Dialogue Override multiple UI''s

Post by mudukke »

I am currently using the dialogue override to trigger a different UI by on trigger enter. But how do I change the dialogue UI on the dialogue sequence. I have a mix of internal dialogue and character talking within the same dialogue tree is there a way to switch between different UI's.
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Override multiple UI''s

Post by Tony Li »

Hi,

Technically you can use C# code to assign a different dialogue UI to the DialogueManager.conversationView.dialogueUI property. But it might be easier to combine both dialogue UIs into a single dialogue UI containing multiple subtitle panels. Then show the internal dialogue in one subtitle panel and the character talking in another.
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Dialogue Override multiple UI''s

Post by mudukke »

Great is there any documentation on how to use the panels?
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Override multiple UI''s

Post by Tony Li »

Hi,

A dialogue UI can have any number of subtitle panels. Most of the dialogue UI prefabs that ship with the Dialogue System have two subtitle panels -- one typically used for the player and one for NPCs. The VN template has 3 subtitle panels. Each subtitle panel has a number (0, 1, 2, etc.). For more info about dialogue UI panels, see Dialogue UIs.

If you add a Dialogue Actor component to an actor's GameObject, you can specify a subtitle panel number. When that actor is involved in a conversation it will use the specified subtitle panel number. (See Character GameObject Assignments.)

In addition, to tell an actor to use a specific subtitle panel for only one dialogue entry, include a [panel=#] markup tag in the dialogue entry's Dialogue Text.

To tell an actor to use a specific subtitle panel for the remainder of the conversation (or permanently, if they have a Dialogue Actor component), use the SetPanel() sequencer command.
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Dialogue Override multiple UI''s

Post by mudukke »

Hi Tony I followed the instructions; however, it doesn't load the UI or sometimes it would get stuck and not switch at when I am using the set panels.
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Override multiple UI''s

Post by Tony Li »

Hi,

Can we look at each issue individually? Please pick one and let's dig into it.

Also, are there any errors or warnings in the Console window?
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Dialogue Override multiple UI''s

Post by mudukke »

OK I used the set panel sequence command, and the error get is this. It doesn't change the panel at all and is unable to switch back to the original panel
Attachments
2024_11_05_10_07_41_Window.png
2024_11_05_10_07_41_Window.png (20.94 KiB) Viewed 70 times
2024_11_05_10_07_20_Window.png
2024_11_05_10_07_20_Window.png (5.89 KiB) Viewed 70 times
2024_11_05_10_07_07_DDNC_V3_LevelDesignBlockout_Windows_Mac_Linux_Unity_2022.3.13f1_DX11_.jpg
2024_11_05_10_07_07_DDNC_V3_LevelDesignBlockout_Windows_Mac_Linux_Unity_2022.3.13f1_DX11_.jpg (12.61 KiB) Viewed 70 times
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Override multiple UI''s

Post by Tony Li »

Hi,

We should address the warning first. It's saying that another conversation is still active. Make sure the previous conversation has ended first. If that conversation ends on a node without text, try adding "Continue()" to its Sequence. (From the "+" dropdown menu, select Continue > Simulate continue button click.)

Assuming the GameObject with the Dialogue Actor set to Internal Dialogue is one of the participants (see Character GameObject Assignments), it will always use panel 1 unless you change it using SetPanel(). So in this case you don't need SetPanel(Internal Dialogue, 1).
mudukke
Posts: 73
Joined: Wed Sep 27, 2023 4:15 am

Re: Dialogue Override multiple UI''s

Post by mudukke »

There was no previous conversation before this. This is the first conversation played in the game;

Regarding the panel, what I am confused by is what I should be assigning the panel to. If its standard dialogue ui, standard subtitle panel, or standard UI menu panel.
I am using Letterbox Template Standard Dialogue prefab as a panel and I am using the JRPG Template standard dialogue prefab

Where do I assign the letterbox standard dialogue prefab in the image below.
Attachments
2024_11_06_11_02_14_Window.png
2024_11_06_11_02_14_Window.png (82.11 KiB) Viewed 47 times
User avatar
Tony Li
Posts: 22034
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Override multiple UI''s

Post by Tony Li »

Hi,

The method we're discussing above switches an actor to use a different subtitle panel, but it doesn't hide the rest of the dialogue UI. It also doesn't entirely replace one dialogue UI's visuals (e.g., JRPG) with another dialogue UI's visuals (Letterbox).

Since you want to change the entire dialogue UI -- and not just show an additional, custom subtitle panel -- you'll need to set the DialogueManager.conversationView.dialogueUI property instead. You could write a custom sequencer command to do that.

1. Add this script to your project:

SequencerCommandUseDialogueUI.cs

Code: Select all

using UnityEngine;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
    public class SequencerCommandUseDialogueUI : SequencerCommand
    {
        private void Awake()
        {
            var ui = DialogueManager.instance.transform.Find(GetParameter(0));
            if (ui == null) Debug.LogError($"UseDialogueUI() can't find Dialogue Manager child GameObject named {GetParameter(0)}");
            else DialogueManager.conversationView.dialogueUI = ui.GetComponent<IDialogueUI>();
        }
    }
}
2. Add a Canvas child GameObject to the Dialogue Manager. Add an instance of the Letterbox dialogue UI to it.

3. In your conversation, use this sequencer command in the Sequence field:

Code: Select all

UseDialogueUI(Letterbox Template Standard Dialogue UI)
If you've named the instance of the Letterbox dialogue UI something different, use that name instead.

p.s. - Do you have any idea why this warning appears?

Image
Post Reply