Page 1 of 1

moving canvas out of dialogue manager prefab hierarchy

Posted: Mon Jun 12, 2023 12:07 am
by lemonjolly_anna
hello!

is it possible to move the Canvas child object from the DialogueManager prefab?
When I tried, the conversations wouldn't play anymore.
Screenshot 2023-06-12 140402.jpg
Screenshot 2023-06-12 140402.jpg (136.35 KiB) Viewed 314 times

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Mon Jun 12, 2023 7:49 am
by Tony Li
It's fine to move the canvas out of the Dialogue Manager GameObject if your game is contained in one scene. The Dialogue Manager is a persistent singleton. This, and its repercussions, are explained in How To: Manage Player Controls and Scene Changes.

What's the reason for moving the canvas? I may be able to suggest a better solution.

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Tue Jun 13, 2023 2:26 am
by lemonjolly_anna
I'm moving it to under a UIManager object which is also a peristent singleton - not sure if that helps!

The reasoning is mostly just for keeping track of things, and being able to easily reference all the canvas active in a scene via the UIManager!

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Tue Jun 13, 2023 8:43 am
by Tony Li
That's fine then. As long as they're both persistent singletons, they'll stay in sync.

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Sun Jun 18, 2023 7:36 am
by lemonjolly_anna
I see! For some reason though, the conversations won't play if I move the canvas out of dialogue manager's hierarchy?

Is it because it breaks the prefab or some other connection?

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Sun Jun 18, 2023 9:22 am
by Tony Li
Yes, almost certainly. The Dialogue Manager survives scene changes. If it points to GameObjects that do not also survive scene changes, those references will become invalid. Related info here: How To: Manage Player Controls and Scene Changes

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Sun Jun 18, 2023 9:35 pm
by lemonjolly_anna
But the canvas does persist across scenes? As in I'm moving the canvas from under the DialogueManager (singleton) to under UIManager (singleton).

Re: moving canvas out of dialogue manager prefab hierarchy

Posted: Sun Jun 18, 2023 9:51 pm
by Tony Li
Hi,

I can't say without more information. When you enter play mode, does the Dialogue Manager's Display Settings > Dialogue UI field still point to a valid dialogue UI?

And when you change scenes, does it still point to a valid dialogue UI?

If so, then are there any errors or warnings in the Console window when you try to start a conversation?