Cleaning up extra dialogue UIs

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
7ports
Posts: 16
Joined: Mon Jun 20, 2022 4:08 pm

Cleaning up extra dialogue UIs

Post 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
User avatar
Tony Li
Posts: 22119
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cleaning up extra dialogue UIs

Post 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.
Post Reply