Page 1 of 1

Cleaning up extra dialogue UIs

Posted: Tue Nov 22, 2022 5:26 pm
by 7ports
Hi Forum,

I'm using the method "UseDialogueUI()" as a way to switch between multiple different UIs within the same scene in my project. All I'm doing in my implementation is using a switch case to pick which UI and then calling "UseDialogueUI()" before calling "StartConversation()" and that seems to work fine.

The issue comes later when I realized that the new dialogue UI instances that are being created aren't being cleaned up after the conversation is complete resulting in many unused UIs in my hierarchy. Is there any functionality for automatically cleaning these up? If not whats the best way to go about keeping these clean? Please let me know if you can help.

Cheers,
Raj

Re: Cleaning up extra dialogue UIs

Posted: Tue Nov 22, 2022 9:55 pm
by Tony Li
Hi Raj,

You can hook into the C# event DialogueManager.instance.conversationEnded to know when the conversation has ended and you can despawn the dialogue UI once its isOpen property is false. However, you might want to keep it in memory but inactive so you can reuse it instead of having to instantiate a new copy.

Alternatively, you can use Override Dialogue UI components.