switching Dialogue UI during runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
alsoknownas-stefan
Posts: 29
Joined: Fri Jul 17, 2020 9:19 am

switching Dialogue UI during runtime

Post by alsoknownas-stefan »

Let's say I want to switch from Dialogue UI (Dialogue Manager gameobject > Dialogue System Controller > Display Settings > Dialogue UI), from VN template to WRPG template, during runtime, because I want to use different UI settings/layouts for different conversations.

Can this be done? Is it as simple as deactivating the template gameobject in Dialogue Manager > Canvas > template and activating a different template gameobject? I think I also need to switch out the reference to the gameobject on the Dialogue System Controller. How would I do that using script?
User avatar
Tony Li
Posts: 22092
Joined: Thu Jul 18, 2013 1:27 pm

Re: switching Dialogue UI during runtime

Post by Tony Li »

Hi,

If you don't want an actor to use the default dialogue UI assigned to the Dialogue Manager's Display Settings > Dialogue UI, add an Override Dialogue UI component to the actor's GameObject and assign the other dialogue UI that you'd like to use. when this actor's GameObject is used as a runtime conversation's primary actor or conversant, the conversation will use this dialogue UI.

If you want to change the default dialogue UI in C#, use DialogueManager.UseDialogueUI(ui). This will take effect with the next conversation that plays.

If you want to change dialogue UIs in the middle of an active conversation, assign your UI to DialogueManager.conversationView.dialogueUI.
alsoknownas-stefan
Posts: 29
Joined: Fri Jul 17, 2020 9:19 am

Re: switching Dialogue UI during runtime

Post by alsoknownas-stefan »

Hi Tony,

Thank you for your detailed answer. Your second approach works for me and I understand the first approach too.

>>If you want to change dialogue UIs in the middle of an active conversation, assign your UI to DialogueManager.conversationView.dialogueUI.

Could you explain this a bit more? I might need this in the future and I do not understand. Is this a property that I can edit in the converdsation window in the dialogue editor? Or do I need to set this by c# code and call it in a sequence/script on the specific line in the dialogue editor? Or different approach?
User avatar
Tony Li
Posts: 22092
Joined: Thu Jul 18, 2013 1:27 pm

Re: switching Dialogue UI during runtime

Post by Tony Li »

DialogueManager.conversationView.dialogueUI is a C# property. If you're currently playing a conversation using one dialogue UI and you'd like to switch that currently-running conversation to a different dialogue UI, use this property. This isn't a commonly-used feature. Most designers use a single dialogue UI throughout the entire run of a conversation, although they might use different UIs for different conversations.
Post Reply