Disable Continue Button for Response/Load Scene on Response

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Roen
Posts: 9
Joined: Fri Jan 31, 2020 1:26 am

Disable Continue Button for Response/Load Scene on Response

Post by Roen »

Hello forum :>
I'm working on a 2D RPG, and I encountered some issues using dialogue system.

1) Is it possible to disable the continue function only when there's options in dialogue?
I am currently on "always" for continue and I turned off "always force response" as I want PC's subtitle to print normally. My continue button is the size of the screen so that player can tap anywhere to continue the dialogue, but I want the response options to be unskippable during dialogue. Player needs to choose an option before proceeding to the remaining part of the dialogue. Is there a way for me to do so?

2)Is it possible to load a different scene upon dialogue response?
I wanted the response options at the end of the dialogue to be something like "enter office", "leave building", "go home". When player picks the option, the respective scene will load and player will be transferred to that scene. How could I set it up?

Thank you so much for your time!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable Continue Button for Response/Load Scene on Response

Post by Tony Li »

Hi,
Roen wrote: Mon Feb 10, 2020 9:03 am1) Is it possible to disable the continue function only when there's options in dialogue?
Set the Dialogue Manager's Subtitle Settings > Continue Button dropdown to Not Before Response Menu.

If the continue button is still visible while the response menu is visible, make sure the continue button is assigned to the subtitle panels' Continue Button field. This allows the subtitle panels to hide the continue button when appropriate (e.g., before a response menu).

I am currently on "always" for continue and I turned off "always force response" as I want PC's subtitle to print normally. My continue button is the size of the screen so that player can tap anywhere to continue the dialogue, but I want the response options to be unskippable during dialogue. Player needs to choose an option before proceeding to the remaining part of the dialogue. Is there a way for me to do so?
Roen wrote: Mon Feb 10, 2020 9:03 am2)Is it possible to load a different scene upon dialogue response?
Yes. Use the LoadLevel() command in the response node's Sequence field, such as:

Code: Select all

LoadLevel(Office)
You can optionally specify a "spawnpoint" where the player should appear in the new scene. The spawnpoint is typically an empty GameObject placed in the scene. Example:

Code: Select all

LoadLevel(Office, FoyerSpawnpoint)
This would place the GameObject tagged "Player" at the position of the FoyerSpawnpoint GameObject in the Office scene.

More info: Cutscene Sequences
Roen
Posts: 9
Joined: Fri Jan 31, 2020 1:26 am

Re: Disable Continue Button for Response/Load Scene on Response

Post by Roen »

Thank you so much for your fast response!
I tried the loadscene out and it worked smoothly.
However, for the response issue,
Tony Li wrote: Mon Feb 10, 2020 9:30 am Hi,
Roen wrote: Mon Feb 10, 2020 9:03 am1) Is it possible to disable the continue function only when there's options in dialogue?
Set the Dialogue Manager's Subtitle Settings > Continue Button dropdown to Not Before Response Menu.

If the continue button is still visible while the response menu is visible, make sure the continue button is assigned to the subtitle panels' Continue Button field. This allows the subtitle panels to hide the continue button when appropriate (e.g., before a response menu).
I threw in a sprite to check on the behaviour of the continue button. I realised that when "Not before response menu" is set, it did disable the continue button. However, I realised that the true issue that caused the dialogue to proceed is that, when I click outside of the dialogue box, the first option of the response is been clicked instead. Anywhere I click when there's a response menu will lead to the first option being clicked. Other options are unclickable.

Objects are assigned accordingly on the standard dialogue UI.
Capturee3.PNG
Capturee3.PNG (51.04 KiB) Viewed 3229 times
Capturee0.PNG
Capturee0.PNG (43.15 KiB) Viewed 3229 times
I modified based on JRPG Template Standard Dialogue UI. The part that I changed under response menu panel is that I replaced the vertical layout group with grid layout group under "Content". I wanted my options to be in columns of 2.

On top of that I assigned a UI button key trigger to the response button template for the button to work.
Capturee1.PNG
Capturee1.PNG (28.08 KiB) Viewed 3229 times
Capturee2.PNG
Capturee2.PNG (44.54 KiB) Viewed 3229 times

I am still new to the unity so I hope this does not confuse you.
May I know why is only the first option of the response clickable? Also why is it clickable even outside of the dialogue box?

Thank you so much for your help.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable Continue Button for Response/Load Scene on Response

Post by Tony Li »

Try removing the UI Button Key Trigger.

The UI Button Key Trigger listens for the Key or Button Name to be pressed. (BTW, Button Name is the name of an input button defined in Edit > Project Settings > Input such as "Fire2". It's not the name of a UI button such as "Response Button Template".) When the input is pressed, the UI Button Key Trigger will "click" the button regardless of what UI element is actually highlighted or what UI element the mouse is over.

You have configured UI Button Key Trigger to listen for the left mouse button. This means that when you press the left mouse button, UI Button Key Trigger will click the UI button no matter where your mouse is.
Roen
Posts: 9
Joined: Fri Jan 31, 2020 1:26 am

Re: Disable Continue Button for Response/Load Scene on Response

Post by Roen »

Thank you so much for clarifying Tony!

I removed the UI key trigger element. However after removing it, the buttons stopped working entirely.
I have the button as a raycast target with button onclick event on StandardUIResponseButton.OnClick(). I also checked force module active under event system - standalone input module.

However when playing, the event system is not detecting anything from dialogue manager UI even though the canvas sort order is the highest. There isn't visible overlay of any element.
It is able to detect another canvas that's displaying a different textbox not using dialogue system.

What could be possibly causing this issue? And how can I go about checking it?
So sorry for the questions and thank you once again for your help and effort!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable Continue Button for Response/Load Scene on Response

Post by Tony Li »

Hi,

Does the dialogue UI's canvas have an enabled Graphic Raycaster? This component allows the Event System to run raycasts on the canvas to detect what the mouse is on top of.

Also make sure that nothing else in the canvas, such as a large invisible image, might be blocking the mouse.

If you don't have any luck, please feel free to send a copy of the scene to tony (at) pixelcrushers.com. I'm wrapping up work for the day, but I'll be happy to take a look tomorrow morning.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable Continue Button for Response/Load Scene on Response

Post by Tony Li »

Hi,

Thanks for sending a reproduction project.

Whenever you add a Canvas component, you must also add a Graphic Raycaster to the same GameObject if its children include any interactable UI elements such as buttons. Otherwise the canvas won't allow any interaction.
Roen
Posts: 9
Joined: Fri Jan 31, 2020 1:26 am

Re: Disable Continue Button for Response/Load Scene on Response

Post by Roen »

Thank you so much Tony you are amazing!
It works perfectly now!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable Continue Button for Response/Load Scene on Response

Post by Tony Li »

Glad to help! :-)
Post Reply