Change UI on runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
KakimaAkuma
Posts: 29
Joined: Mon Sep 09, 2019 9:51 pm

Change UI on runtime

Post by KakimaAkuma »

I've read up on SetPanel() and other Set_() Sequences

I have questions regarding on setting Panels for Responses

EG: I have a set of choices that I change dynamically by using DialogueManager.UpdateResponses();

My question is how can I update my Panel (Button and Layout) at runtime.

Edit: Change panel at the current dialogue node and not at the next node.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change UI on runtime

Post by Tony Li »

Hi,

The dialogue UI scripts aren't really designed for that, but it's possible with a little scripting. You can hide the current panel by calling the dialogue UI's HideSubtitle() and/or HideResponses() methods. Then show a panel by calling ShowSubtitle() and/or ShowResponses().

Or, if you think it would be simpler, you can provide your own UI implementation of the IDialogueUI C# interface. It just has a few methods such as ShowSubtitles and ShowResponses that you'd need to implement.
KakimaAkuma
Posts: 29
Joined: Mon Sep 09, 2019 9:51 pm

Re: Change UI on runtime

Post by KakimaAkuma »

After I make my own script, which is a better approach.

Should I subscribe my newly written stuff to Lua, or should I make a new Sequencer?
KakimaAkuma
Posts: 29
Joined: Mon Sep 09, 2019 9:51 pm

Re: Change UI on runtime

Post by KakimaAkuma »

Follow-up question: Also what script actually runs when a dialogue is being run?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change UI on runtime

Post by Tony Li »

I'm not sure I follow. For the most part, the dialogue UI runs independently of Lua and the sequencer. When the Dialogue System plays a dialogue entry, it calls the dialogue UI's ShowSubtitle() method. Independently, it calls the sequencer's PlaySequence() method, which is not part of the dialogue UI.

There are some exceptions. The SetPanel() sequencer command will check the current dialogue UI for a StandardDialogueUI component and make changes to it (e.g., show or hide a panel).

But, in general, if you write your own IDialogueUI implementation, you don't have to worry about the sequencer or Lua.

However, if you want to write a custom sequencer command to control your IDialogueUI implementation (for example, or change a subtitle panel), you can do that.
Post Reply