Hiding the UI panel on every subtitle

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
xTcHero
Posts: 2
Joined: Thu Nov 24, 2022 5:26 pm

Hiding the UI panel on every subtitle

Post by xTcHero »

Hi,

we've been using your dialogue system in our company for a few months, and so far it's been a decent experience. However, one thing that I just can't figure out is how to trigger the close animation in the UI Panel Animator on individual subtitles. I tried using sequences, setting the animator state directly, but they always fade in and out instantly, without waiting for the subtitles to end, even with the @{{end}} tag at the end.

I tried hooking the UI Panel script into the dialogue system conversation events, to manually open/close the UI panel when a new line is received and has ended, which is the closest I've come so far.

What I'm trying to achieve is alternating between a jRPG-style dialogue box for the NPC and chat bubbles for the player. The dialogues themselves play out just fine, and appear as they should, but the dialogue box won't fade out at the end of the subtitle. The subtitle panel works as intended, but I'd like to see the UI Panel's canvas group alpha to be animated on select subtitles.

Thanks!
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hiding the UI panel on every subtitle

Post by Tony Li »

Hi,

What if you change the subtitle panel's Visibility to Only During Content or Until Superceded? This should work if the subtitle panel is visually its own UI panel. But if it assumes that the dialogue UI's main dialogue panel shows the frame image, then it will only hide its own elements but not the frame image.
xTcHero
Posts: 2
Joined: Thu Nov 24, 2022 5:26 pm

Re: Hiding the UI panel on every subtitle

Post by xTcHero »

Yeah, so that's exactly our issue - the subtitle panel is a child of the dialogue main dialogue panel, so setting the subtitle panel's visibility only works for the subtitles themselves.

While testing, I found that the dialogue UI panel does function as intended by the end of the conversation - just not on every subtitle. I need to hide the dialogue box whenever chat bubbles are used (not explicitly - just need to make sure it's out of the way).

Thanks for the hasty response!
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hiding the UI panel on every subtitle

Post by Tony Li »

Hi,

Here are two ways you could do that:

1. Move all of the visible UI elements from the main dialogue UI's main dialogue panel to the subtitle panel. This way, when the subtitle panel hides itself, it will hide all of the visible UI elements.

2. Or manually hide the main dialogue UI. There are two ways to do this: SetDialoguePanel(false) sequencer command or disable the dialogue UI's Canvas. Assuming the dialogue UI is in the Dialogue Manager's Default Canvas, you could add a script to your bubble panel that disables the Default Canvas when opening the bubble and re-enables it when closing the bubble. Something like:

Code: Select all

[RequiredComponent(typeof(StandardUISubtitlePanel))]
public class HideDialogueCanvas : MonoBehaviour
{
    private StandardUISubtitlePanel panel;
    
    void Awake()
    {
        panel = GetComponent<StandardUISubtitlePanel>();
        panel.onOpen.AddListener(DisableMainOnOpen);
        panel.onClose.AddListener(EnableMainOnClose);
    }
    
    void OnDestroy()
    {
        panel.onOpen.RemoveListener(DisableMainOnOpen);
        panel.onClose.RemoveListener(EnableMainOnClose);
    }
    
    void DisableMainOnOpen()
    {
        DialogueManager.displaySettings.defaultCanvas.enabled = false;
    }
    
    void EnableMainOnClose()
    {
        DialogueManager.displaySettings.defaultCanvas.enabled = true;
    }
}
Post Reply