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.
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?
How to use existing dialogue UI, and not create new instance?
-
- Posts: 4
- Joined: Fri Jul 01, 2022 10:24 am
Re: How to use existing dialogue UI, and not create new instance?
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:
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);
}
-
- Posts: 4
- Joined: Fri Jul 01, 2022 10:24 am
Re: How to use existing dialogue UI, and not create new instance?
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. 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.
I've actually already tried assigning the SMS Dialogue UI to the Dialogue Manager's Dialogue UI field, to no avail. 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?
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
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
-
- Posts: 4
- Joined: Fri Jul 01, 2022 10:24 am
Re: How to use existing dialogue UI, and not create new instance?
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.
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?
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.