Page 1 of 1

Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 12:15 am
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!

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 12:34 am
by Tony Li
Hi,

To switch UIs mid-conversation, assign the new UI to DialogueManager.conversationView.dialogueUI.

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 1:37 am
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?

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 10:49 am
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;
}

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 6:36 pm
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?

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 7:50 pm
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.

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 8:33 pm
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

Re: Change whole Dialogue UI during conversation

Posted: Thu May 23, 2024 8:51 pm
by Tony Li
Glad to help!