Change whole Dialogue UI during conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
myshkin
Posts: 4
Joined: Wed May 22, 2024 11:49 pm

Change whole Dialogue UI during conversation

Post by myshkin »

Hi,

Apologies if this has been explained elsewhere but I've done lots of searching here and haven't found an answer yet.

I'm working on a scene where I want to switch from a standard interactive dialogue UI to a simple narrator "subtitles only" UI and then back again, preferably inside the same conversation. Using different subtitle panels hasn't worked, because for the second UI I don't want any of the other components (background image, divider line, etc). So far I've been able to achieve this by ending the first conversation and immediately starting a new one, which has its own override UI, but this ends up quite complicated and I'm sure I'm going the wrong way about it. Quick examples of the 2 different UIs:

https://drive.google.com/file/d/1Um-ERu ... drive_link

https://drive.google.com/file/d/1EpXwFM ... drive_link

Is there any way of switching out the whole dialogue UI during a conversation? Or if not, is there another simpler way of switching to this "narrator mode" type of subtitles?

Thanks!
User avatar
Tony Li
Posts: 20992
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change whole Dialogue UI during conversation

Post by Tony Li »

Hi,

To switch UIs mid-conversation, assign the new UI to DialogueManager.conversationView.dialogueUI.
myshkin
Posts: 4
Joined: Wed May 22, 2024 11:49 pm

Re: Change whole Dialogue UI during conversation

Post by myshkin »

Hi Tony,

Thanks for the quick response! I've had a look and I'm not sure exactly where I should be assigning this - do I need to edit the DialogueSystemController script to add a second UI prefab and write a function to be called from within a conversation?
User avatar
Tony Li
Posts: 20992
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change whole Dialogue UI during conversation

Post by Tony Li »

Hi,

No, you can set it in your own script. Just include that line in your script, such as:

Code: Select all

using PixelCrushers.DialogueSystem; // Include at top of script.

public StandardDialogueUI otherDialogueUI; // Assign in inspector (for example).

public void UseOtherDialogueUI() // Call this when you want to use the other UI.
{
    DialogueManager.conversationView.dialogueUI = otherDialogueUI;
}
myshkin
Posts: 4
Joined: Wed May 22, 2024 11:49 pm

Re: Change whole Dialogue UI during conversation

Post by myshkin »

Ah that makes sense, thank you. I have this set up now, but when I call the UseOtherDialogueUI function the UI just seems to go blank while the conversation continues (I've tried this with a few of the pre-made dialogue UIs to make sure it's not due to the way I've set up my UI).

I noticed that when I assign the new UI to this script, it links directly to the StandardDialogueUI script, whereas the Dialogue System Controller and Override Dialogue UI components link to the actual UI game object. Should the game object of the second dialogue UI be held somewhere else in the scene too, or added within my main dialogue UI somehow?
User avatar
Tony Li
Posts: 20992
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change whole Dialogue UI during conversation

Post by Tony Li »

Hi,

otherDialogueUI should be a GameObject (with a StandardDialogueUI component) in your scene, not a prefab. If it's a prefab, that might be the issue.
myshkin
Posts: 4
Joined: Wed May 22, 2024 11:49 pm

Re: Change whole Dialogue UI during conversation

Post by myshkin »

Great, yes this got it working - I added my new UI gameobject as a child of the canvas in the Dialogue Manager gameobject in my scene, and I can now easily switch between the two UIs during a conversation. Thanks Tony! :D
User avatar
Tony Li
Posts: 20992
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change whole Dialogue UI during conversation

Post by Tony Li »

Glad to help!
Post Reply