Hiding a UI panel (Unity UI)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Kromgar
Posts: 2
Joined: Sun Oct 23, 2016 3:17 pm

Hiding a UI panel (Unity UI)

Post by Kromgar »

Hi,

Is it possible to hide a Dialogue Panel in the sequence, and then resume the same conversation after completing every other sequence of a dialogue entry?
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hiding a UI panel (Unity UI)

Post by Tony Li »

Hi,

Sure, there are a few ways to do it. I'll describe how to use sequencer commands. Make sure your Dialogue Panel has a unique name (e.g., "Dialogue Panel"). Use the SetActive() sequencer command to set it inactive at the beginning of the sequence.

Then set your sequence to something like this example:

Code: Select all

SetActive(Dialogue Panel,false);
Camera(Wide,speaker,2); 
AnimatorPlay(Dance);
AudioWait(Rhumba)->Message(Done);
AnimatorPlay(Idle)@Message(Done);
SetActive(Dialogue Panel)@Message(Done)
Here's what this sequence does, line by line:

1. SetActive(Dialogue Panel,false): Hides the Dialogue Panel.

2. Camera(Wide,speaker,2): Moves the camera to a wide shot of the speaker over 2 seconds.

3. AnimatorPlay(Dance): Plays the speaker's Dance animator state.

4. AudioWait(Rhumba)->Message(Done): Plays the audio clip "Rhumba" and waits until it's done; then sends a sequencer message "Done". (The message can be any string of your choice.)

5. AnimatorPlay(Idle)@Message(Done): When the message "Done" has been sent, plays the speaker's Idle state.

6. SetActive(Dialogue Panel)@Message(Done): When the message "Done" has been sent, shows the Dialogue Panel.

Other approaches: use the dialogue entry's On Execute event (e.g., trigger an animation that fades out the panel for a duration), or a C# script that listens for script messages, or use a scrubbing cutscene editor like Cinema Director or SLATE. (The Dialogue System has integration with several cutscene editors.)
Kromgar
Posts: 2
Joined: Sun Oct 23, 2016 3:17 pm

Re: Hiding a UI panel (Unity UI)

Post by Kromgar »

Thank you! I managed to make my sequences work, but I couldn't find a way to continue the dialogue after that. The order of my conversation looks something like this : (START - Node with a text - "Empty" node with sequences (hiding UI, etc.) - Node with a text - END). Is there a way to skip the "Empty" node after its execution without actually pressing the continue button?
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hiding a UI panel (Unity UI)

Post by Tony Li »

In your empty node with sequences, use the SetContinueMode() sequencer command:

Code: Select all

SetContinueMode(false);
...(your other sequencer commands)...
And in the next node re-enable continue button mode:

Code: Select all

SetContinueMode(true)
Alternatively, if you want the player to be able to still use the continue button to bypass the sequence, you can simulate a continue button click at the end of the sequence by adding a line similar to this:

Code: Select all

SendMessage(OnContinue,,Dialogue Manager,broadcast)@Message(Done)
The easiest way to get that line into your sequence is to select it from the "+" menu:

Image
then add "@Message(Done)" or whatever message you're using at the end.
Post Reply