Page 1 of 2

Changing Dialogue UI on runtime

Posted: Tue Mar 29, 2016 6:42 am
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 :)

Re: Changing Dialogue UI on runtime

Posted: Tue Mar 29, 2016 9:30 am
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.

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 5:30 am
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

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 9:12 am
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?

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 3:58 pm
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

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 4:04 pm
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.

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 4:29 pm
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?

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 5:48 pm
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.

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 6:01 pm
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.

Re: Changing Dialogue UI on runtime

Posted: Thu Mar 31, 2016 7:26 pm
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.