Page 1 of 1
Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Tue Mar 01, 2022 11:55 pm
by irongamer
Spent some time searching the forum but failed to find an example, likely just missed it here or in the docs.
I'd basically like two UIs:
- A dialogue UI (already setup and working)
- A book/letter/note UI
Can the dialogue system controller change to different dialogue UIs at run time? I'm trying to keep most of the game text in the dialogue system database and would like to have book/note/letter content displayed with a different UI. I have one dialogue system controller and one dialogue UI prefab setup to handle actual dialogue.
Is there a best practice for launching different conversations in different dialogue UI prefabs? Should I be using two dialogue system controllers? I didn't see a way to choose a dialogue system controller or dialogue ui in the dialogue system trigger, so I'm not sure how to approach this idea.
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Wed Mar 02, 2022 7:24 am
by Error412
Hi, once Tony logs will surely give you a better answer than mine, but if you want to give it a try in the meantime this is what I did for a similar situation:
-Just one dialogue system controller
- Under the Dialogue Manager Canvas move the 2 dialogue UI prefabs you want to use. Assign the main one the Dialogue UI field of Dialogue System controller component.
- On the button that triggers your "book/note" dialogue add an Override Dialogue UI component
http://www.pixelcrushers.com/dialogue_s ... e_u_i.html. Within it drag on the UI field your "book/note" UI object that you added to your Canvas.
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Wed Mar 02, 2022 8:23 am
by Tony Li
Error412 is exactly right. Use an
Override Dialogue UI component.
Interactable items such as books usually only exist in one scene. (To say it another way, they are not marked Don't Destroy On Load, so they don't persist across scene changes.) Since the book only exists in one scene, and since the Dialogue Manager persists across scene changes, assign a dialogue UI prefab asset or a scene-specific instance of your book dialogue UI to its Override Dialogue UI field. That way it won't lose its reference to the dialogue UI as you change through different scenes.
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Wed Mar 02, 2022 10:43 pm
by irongamer
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Thu Mar 03, 2022 7:59 am
by Tony Li
Glad to help!
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Mon Aug 01, 2022 2:25 pm
by timbecile
Hey Tony,
would this same setup work for cutscenes? Like one UI for regular dialog, and a different UI for a cutscene?
Re: Change dialogue ui at runtime? Multiple dialogue UI prefab support?
Posted: Mon Aug 01, 2022 3:03 pm
by Tony Li
Absolutely! That's a common use for Override Dialogue UI.