Page 1 of 1

OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 7:08 am
by Pendergast
Hi !

Lately, I've been working on the Dialogue UI for my game and I've had to try a lot of things to customize it for Dialogue System. I've been struggling a lot with sorting the UI layers.

To sort out the gameobject UI, I wanted to use the Canvas component: unfortunately, it prevented the continue button (transparent and extended over the whole screen to switch from dialog on click), so I had to move the gameobjects order. Some elements are no longer in the right panel groups, but the layer order rendering is correct.

However, when the reponse menu panel opens in game, the subtitle panel is still displayed behind the response menu panel. I don't know if this is normal.

So I wanted to use the OpenPanel() command to close my "Dialogue Panel" panel (knowing that my panel menu response is not in it) but it doesn't work cause i can't target the command OpenPanel() on the gameobject i want.

To simplify, my two questions are:

1. Is it possible to sort the order of the UI gameobjects with the Canvas component, without preventing the continue button to work?
2. Is it possible to use the OpenPanel() command to target a particular panel (example: OpenPanel(Dialog Panel,close)) ?

Thank you in advance and sorry if it is not clear, I have a little trouble to express myself in English!

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 9:37 am
by Tony Li
Hi,
Pendergast wrote: Mon Oct 26, 2020 7:08 am1. Is it possible to sort the order of the UI gameobjects with the Canvas component, without preventing the continue button to work?
Move the continue button below the response menu. The screenshot below is based on the VN template:

continueButtonOnTop.png
continueButtonOnTop.png (13.11 KiB) Viewed 874 times

If your continue button is inside the subtitle panel in your dialogue UI, you can move it outside of the subtitle panel.
Pendergast wrote: Mon Oct 26, 2020 7:08 am2. Is it possible to use the OpenPanel() command to target a particular panel (example: OpenPanel(Dialog Panel,close)) ?
I don't think you will need to do this. Instead, inspect the subtitle panel. Change the Visibility dropdown to Only During Content. This will hide the subtitle panel after it shows its content. However, if you show two NPC lines in a row, it will show and hide between each lines.

Alternatively, you can connect the response menu panel's OnOpen() UnityEvent to the subtitle panel's StandardUISubtitlePanel.Close method, and leave the subtitle panel's Visibility at its original value.

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 10:19 am
by Pendergast
Hi,

1. Thanks ! The button works even with the canvas component, now !

2. Like you said, for the panel show and hide between each lines of characters. How can i connect the menu panels with the OnOpen() ? I don't think i saw this command on the documentation.

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 11:10 am
by Tony Li
Hi,

You don't need to write any code or sequencer commands. Just hook it up in the inspector:

menuPanelCloseSubtitle.png
menuPanelCloseSubtitle.png (114.12 KiB) Viewed 869 times

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 11:31 am
by Pendergast
Hi,

Thank you !! It worked !

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 11:36 am
by Tony Li
Happy to help!

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 1:41 pm
by Pendergast
Hi,

So, i have a big problem with the continue button.

I created a Prefab of my UI. I dropped it into the Dialogue Manager Gameobject, and tried to use the ""Add Instance" option : doing so, my continue button doesn't work now. Not even in the prefab. I don't know what to do now :(

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 2:03 pm
by Tony Li
Hi,

Maybe another UI is being added to the canvas and blocking your dialogue UI?

As a test, try disabling the Instantiate Prefabs component. Then play the scene. If you can click the continue button, then one of the prefabs listed in Instantiate Prefabs is blocking.

If so, here is one way to resolve this: Create another canvas as a child of the Dialogue Manager GameObject. Set its Sort Order to -1 so it will be less than the Dialogue Manager's original Canvas. Then assign this new canvas to the Instantiate Prefabs component.

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 5:27 pm
by Pendergast
Hi,

It was a bug, some of my components was gone (graphic raycast and canvas group) !

Thanks !

Re: OpenPanel() and UI layer/canvas

Posted: Mon Oct 26, 2020 7:49 pm
by Tony Li
Happy to help!