Changing Dialogue UI on runtime

Announcements, support questions, and discussion for the Dialogue System.
addym55
Posts: 7
Joined: Tue Mar 29, 2016 6:33 am

Changing Dialogue UI on runtime

Post by addym55 »

Hi

Is it possible to switch between 2 different Dialogue UIs on run-time during a on-going conversation?
I tried using
DialogueManager.DisplaySettings.dialogueUI = UI2;
and
DialogueManager.UseDialogueUI(UI2);
via sendMessage() in sequence but it didn't work. Please let me know if it is possible.

Thanks for the support :)
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Dialogue UI on runtime

Post by Tony Li »

Hi,

It's not easy to switch between 2 different dialogue UIs during an active conversation, but it can be done.

What is the effect you want to achieve? I'll try to suggest the best way to do it.
addym55
Posts: 7
Joined: Tue Mar 29, 2016 6:33 am

Re: Changing Dialogue UI on runtime

Post by addym55 »

Hi

I actually want to combine the Button template feature with fixed Buttons in Player Response panel.
I want all regular dialogues to be as Button template, but fixed buttons for multiple choice questions.
Also I want to change Timer which is a slider to my custom timer which is just a animated Sprite.
Please let me know if these can be achieved.

Thank again for your time.

Cheers
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Dialogue UI on runtime

Post by Tony Li »

Hi,

It'll be easiest to do it all in one UI. Briefly, you'll need to do this:
  • If a response is a multiple choice question, add it to the fixed Buttons list. Otherwise add it using the Button Template.
  • Change the timer to show an animated sprite instead of controlling a slider.
How will you distinguish between multiple choice questions and regular dialogues? (A custom field may be helpful. Let me know if you want some advice on this.) Can a response menu have multiple choice questions and regular dialogues at the same time?
GreenishFlow
Posts: 5
Joined: Thu Mar 31, 2016 12:17 pm

Re: Changing Dialogue UI on runtime

Post by GreenishFlow »

Hello.
I have a same problem, I need to switch UI. I have 2 types of the dialogue: regular and chat-mode (i found the extension for chat log style UI) and I need to switch it in runtime according some variable. is it possible?
Thanks
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Dialogue UI on runtime

Post by Tony Li »

Hi,
GreenishFlow wrote:Hello.
I have a same problem, I need to switch UI. I have 2 types of the dialogue: regular and chat-mode (i found the extension for chat log style UI) and I need to switch it in runtime according some variable. is it possible?
Thanks
It sounds like in this case you can just add an Override Dialogue UI component to the conversant (e.g., the NPC). To see an example, open the Feature Demo scene and inspect the "Terminal active" GameObject. It has an Override Dialogue UI component to use a computer-themed UI instead of the regular sci-fi UI.
GreenishFlow
Posts: 5
Joined: Thu Mar 31, 2016 12:17 pm

Re: Changing Dialogue UI on runtime

Post by GreenishFlow »

Tony Li wrote:Hi,
GreenishFlow wrote:Hello.
I have a same problem, I need to switch UI. I have 2 types of the dialogue: regular and chat-mode (i found the extension for chat log style UI) and I need to switch it in runtime according some variable. is it possible?
Thanks
It sounds like in this case you can just add an Override Dialogue UI component to the conversant (e.g., the NPC). To see an example, open the Feature Demo scene and inspect the "Terminal active" GameObject. It has an Override Dialogue UI component to use a computer-themed UI instead of the regular sci-fi UI.

Thanks! May be it's possible somehow in code?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Dialogue UI on runtime

Post by Tony Li »

GreenishFlow wrote:Thanks! May be it's possible somehow in code?
Sure, in code just call DialogueManager.UseDialogueUI(gameObject) before starting the conversation.
GreenishFlow
Posts: 5
Joined: Thu Mar 31, 2016 12:17 pm

Re: Changing Dialogue UI on runtime

Post by GreenishFlow »

Tony Li wrote:
GreenishFlow wrote:Thanks! May be it's possible somehow in code?
Sure, in code just call DialogueManager.UseDialogueUI(gameObject) before starting the conversation.
Hmm, but what if my conversations are linked? so i can't handle the place "before starting", i can handle only OnLinkedConversationStart, but UseDialogueUI doesn't work in this way.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Changing Dialogue UI on runtime

Post by Tony Li »

Since the Dialogue System is modular, your UI options are really wide open. You're not confined to the way that the UnityUIDialogueUI class does it. You could write your own UI script that implements the IDialogueUI interface. It's only a handful of methods like ShowSubtitle and ShowResponses.

If you want to use the Unity UI scripts that come with the Dialogue System, here are a few ideas:

- In OnLinkedConversationStart, record the current conversation (DialogueManager.CurrentConversationState) and then stop it (DialogueManager.StopConversation). Then call UseDialogueUI to change the dialogue UI. Finally, call the version of DialogueManager.StartConversation that lets you start a conversation at a specific dialogue entry ID.

- Or, use a single UnityUIDialogueUI script. When you want to switch UIs, just swap out all the UI element assignments (e.g., NPC Subtitle Panel, NPC Subtitle Line, etc.). If you're using the Conversation Log Dialogue UI from the Extras page, this idea may require a little adjustment.
Post Reply