Switching between two dialogue ui

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Arturicon
Posts: 12
Joined: Mon Mar 11, 2024 2:52 pm

Switching between two dialogue ui

Post by Arturicon »

I believe there is somewhere such topic, but i couldn't find it. I want to make two completely different dialogue ui. One of them is for ordinary events (it's just window with text and menu) and another one is more complex for real dialogs with character pictures and camera movement (as in Banner Saga). I don't how to switch them depending on specific conversation which trigger it.
I suppose it has something to do with OverrideDisplaySettings, but im not shure how to use it to achieve my goals
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching between two dialogue ui

Post by Tony Li »

Hi,

You can use an Override Dialogue UI component. Add it to a character, and assign a dialogue UI. If either primary participant in a conversation has an Override Dialogue UI component, the conversation will use the Override Dialogue UI's dialogue UI instead of the default one that was assigned to the Dialogue Manager GameObject's Display Settings > Dialogue UI.

More info about participants: Character GameObject Assignments

I suggest assigning your more complex dialogue UI to the Dialogue Manager's Display Settings > Dialogue UI component.

Then create an empty GameObject for an "Events" actor that you can use in your ordinary event conversations. Add an Override Dialogue UI to it, and assign your simple text + menu dialogue UI to it. Add a Dialogue Actor component to your Events GameObject, and set the Actor dropdown to Events.
Arturicon
Posts: 12
Joined: Mon Mar 11, 2024 2:52 pm

Re: Switching between two dialogue ui

Post by Arturicon »

Thanks, it helped a lot. By the way i also wonder can i change dialog ui right in the middle of dialog in depending on who speaking?
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching between two dialogue ui

Post by Tony Li »

It's probably best to use different subtitle panels in that case. But, yes, it is possible to change dialogue UIs. Assign a different UI to the C# property DialogueManager.conversationView.dialogueUI. The easiest way to use different subtitle panels is to add a Dialogue Actor component to the character's GameObject and set Dialogue UI Settings > Subtitle Panel Number.
Arturicon
Posts: 12
Joined: Mon Mar 11, 2024 2:52 pm

Re: Switching between two dialogue ui

Post by Arturicon »

I'm calling Dialogue Manager.conversationView.dialogue UI = newDialogueUI; by Lua when reaching required Dialogue Entry and the old DialogueUI disappearing, but new one doesn't show up. Should i write something else?
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching between two dialogue ui

Post by Tony Li »

Are there any errors or warnings in the Console window?

If you check the new UI's subtitle text, does it contain the dialogue entry's text?
Arturicon
Posts: 12
Joined: Mon Mar 11, 2024 2:52 pm

Re: Switching between two dialogue ui

Post by Arturicon »

There is a Dialog Entry where i call TestChangeUI() { DialogueManager.conversationView.dialogueUI = testDialogueUI;}
And actor - Result which i bind to new Dialogue UI
And when i reaching Dialog Entry where actor is Result and old DialogueUi disappeared and i getting this in console
Рассказчик, Барсег and Result are actors in this conversation.

Any way, you suggested me to change subtitles panel, but there is also some custom panels and menu panels that need to be changed. So if i need completely change the view i suppose i should change whole dialogue UI. Or i don't understand something wrong?
Attachments
Screenshot 2024-03-19 230741.png
Screenshot 2024-03-19 230741.png (21.96 KiB) Viewed 585 times
Screenshot 2024-03-19 230727.png
Screenshot 2024-03-19 230727.png (48.98 KiB) Viewed 585 times
Screenshot 2024-03-19 230649.png
Screenshot 2024-03-19 230649.png (27.16 KiB) Viewed 585 times
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching between two dialogue ui

Post by Tony Li »

Here's an example:

DS_ChangeDialogueUIExample_2024-03-19.unitypackage

I just used the SendMessage() sequencer command, but that shouldn't make a difference from using a custom sequencer command or Lua function.
Arturicon
Posts: 12
Joined: Mon Mar 11, 2024 2:52 pm

Re: Switching between two dialogue ui

Post by Arturicon »

Thank you) It works now. My mistake was that i was trying to activate new ui that was just prefab, but i had to put it in canvas in dialog manager as an gameobject already.
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching between two dialogue ui

Post by Tony Li »

Hi,

Yes, that's something I should have made clearer. If you assign a prefab to the Dialogue Manager's Display Settings > Dialogue UI field, the Dialogue Manager will instantiate it when it starts up. But if you just assign conversationView.dialogueUI it won't instantiate a prefab.
Post Reply