How to change Dialogue UI in runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Jdedueass
Posts: 10
Joined: Wed Aug 18, 2021 3:17 am

How to change Dialogue UI in runtime

Post by Jdedueass »

Hi!

I'm trying to change the dialogue UI in runtime and I can't figure out how to do it by myself.

For context, the game I'm building has the default conversations with NPC's and a dialogue battle. Once the dialogue battle starts I would like to change the UI, and once it ends, change it back to the default UI for conversations.

I hope it's clear and thanks in advance!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue UI in runtime

Post by Tony Li »

Hi,

The easiest way is use a unique GameObject for the battle conversation's conversant -- for example, maybe a GameObject named BattleManager that's a child of the Dialogue Manager GameObject. Add an Override Dialogue UI component to this GameObject, and assign your battle UI. Conversations that involve this GameObject will use the battle UI instead of your default UI.

Alternatively, you can call DialogueManager.SetDialogueUI() in C# before starting the conversation.
Jdedueass
Posts: 10
Joined: Wed Aug 18, 2021 3:17 am

Re: How to change Dialogue UI in runtime

Post by Jdedueass »

Thanks Tony! Surely it seems to be easier than I thought. I'll try it, thanks again.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change Dialogue UI in runtime

Post by Tony Li »

Happy to help!
Post Reply