Page 1 of 1

Hide dialogue box via button click

Posted: Mon Aug 21, 2023 11:33 pm
by Eoran
Hello! I'm back again with another newbie question. I'm trying to create a "close and pause dialogue" button but it seems like I can't set the dialogue panel to be inactive/0 alpha. Dialogue manager instantiates (even with instantiate prefab disabled) the dialogue UI only during gameplay and there seems to be no way for me to access it in the scene outside of it so there's nothing for my button to reference. Not sure what I should do here so any help would be appreciated!

Additionally, I'd like the dialogue and panel to be unpaused and reactivated when I make another click anywhere on screen. Is there a way to do so?

Ty in advance!

Re: Hide dialogue box via button click

Posted: Tue Aug 22, 2023 8:24 am
by Tony Li
Hi,

At runtime, you can access the dialogue UI using the property DialogueManager.standardDialogueUI.

If you want, you can also add an instance of the dialogue UI to the Dialogue Manager's Canvas at design time and assign this instance to the Dialogue Manager's Display Settings > Dialogue UI field in place of the prefab. The Dialogue System will use this instance instead of instantiating a prefab in this case.

One way to hide the dialogue UI via button click is to add a full-screen invisible button as the back-most UI element of the dialogue UI. There are a few ways you could configure it to hide the dialogue panel. You could configure its OnClick() event to set the dialogue panel's Canvas Group > Alpha to zero. You could additionally configure it to activate another UI Button that sets the Canvas Group > Alpha back to 1 to show the dialogue UI again.