Hello!
I've been trying to sort things out with a recent issue I've been dealing with.
The gist is, my game's current Manager breaks when you go into different scenes, due to the Manager losing access to the Canvas and the DialogueUI upon scene transition, despite the DialogueManager itself being a proper Instance.
This confuses me since I've tried both making the DialogueUI a Prefab, or an instance, but both yield the same error "MissingReferenceException: The object of type 'StandardDialogueUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object." when I try playing conversations in different scenes. At first I thought this was because I had other DialogueManagers in each scene for debugging purposes, but now that I've gotten rid of some of it, the same issue continues to happen.
What can I do to fix this? I don't think there's anything that would destroy the DialogueUI's references, barring some kind of odd instancing issue?
DialogueManager losing reference to Canvas and UI across Scenes
-
- Posts: 47
- Joined: Tue May 16, 2023 10:37 pm
Re: DialogueManager losing reference to Canvas and UI across Scenes
Hi,
It's okay to have a Dialogue Manager in each scene. It makes it easier to playtest each scene individually in the Unity editor's play mode without having to come from some other scene.
Make sure assignments are within the Dialogue Manager's hierarchy. Please see How To: Manage Player Controls and Scene Changes for an explanation of what's probably going on and how to address it. If your Dialogue Manager is losing its reference to the dialogue UI, put the dialogue UI in the Dialogue Manager's hierarchy, such as a child of the Dialogue Manager's Canvas.
It's okay to have a Dialogue Manager in each scene. It makes it easier to playtest each scene individually in the Unity editor's play mode without having to come from some other scene.
Make sure assignments are within the Dialogue Manager's hierarchy. Please see How To: Manage Player Controls and Scene Changes for an explanation of what's probably going on and how to address it. If your Dialogue Manager is losing its reference to the dialogue UI, put the dialogue UI in the Dialogue Manager's hierarchy, such as a child of the Dialogue Manager's Canvas.