Page 1 of 1
How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 10:31 am
by darkmalice
Hi, nooby question.
I'm using the SMS Dialogue UI, which I have in the scene under an existing hierarchy here under the contentDialogue panel.
- Capture11.JPG (32.32 KiB) Viewed 268 times
However, at runtime the DialogueManager will always instantiate it's own SMS Dialogue UI from the prefab, and referencing the Cellphone canvas will just cause it to instantiate it there.
So, how would one go about forcing DialogueManager to not instantiate, and instead use the existing scene object?
Re: How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 10:49 am
by Tony Li
Hi,
Assign your existing scene instance of the SMS Dialogue UI to the Dialogue Manager's Dialogue UI field.
However, if your game changes scenes, your Cellphone GameObject must survive scene changes, since the Dialogue Manager survives scene changes. Otherwise the Dialogue UI field will end up pointing to nothing after a scene change. For an explanation with screenshots, see
this article. It explains it in the context of a Player GameObject instead of a Cellphone GameObject, but it's the same idea.
If your Cellphone doesn't survive scene changes, you can use an
Override Dialogue UI component on one of the participants (and assign your SMS Dialogue UI scene instance), or assign the dialogue UI at runtime in a script, such as:
Code: Select all
void Start()
{
DialogueManager.UseDialogueUI(your_SMSDialogueUI_Scene_Instance);
}
Re: How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 10:59 am
by darkmalice
Thanks for the reply.
I've actually already tried assigning the SMS Dialogue UI to the Dialogue Manager's Dialogue UI field, to no avail.
- cap1.JPG (36.18 KiB) Viewed 263 times
It seems determined to create it's own object.
And thank you for the advice on changing scenes, I'm sure that will be useful going forward.
Re: How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 11:17 am
by Tony Li
Hi,
Please double-check that the SMS Dialogue UI that's inside Cellphone ... ContentDialogue is assigned to the Dialogue Manager's Dialogue UI field.
Here's a test scene that's set up that way:
DS_UseSceneDialogueUITest_2022-07-01.unitypackage
Re: How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 11:28 am
by darkmalice
Yeah it's the right one.
It appears to be because ContentDialogue is inactive, and even though I'm setting it active before triggering DS Use(), the DS is too quick and goes ahead to make it's own instance. If I leave the ContentDialogue active it will indeed use the assigned object.
Thanks for your help Toni, I'm sure I can fudge it now.
Re: How to use existing dialogue UI, and not create new instance?
Posted: Fri Jul 01, 2022 11:31 am
by Tony Li
Glad to help! You can leave ContentDialogue and SMS Dialogue UI active, and deactivate Alert Panel and Dialogue Panel. The SMS Dialogue UI will automatically activate Alert Panel and Dialogue Panel as needed.