Change Continue button with left click mouse

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Change Continue button with left click mouse

Post by ichisan »

Hello,
I've bought dialogue system manager a long time ago, but decided to using it now. I totally newbs btw,
So I have a question,
I want to hide the continue button so I go to next dialogue only with mouse input (left click) or keyboard (space) instead.
How to make this possible?
Thank you
Attachments
raysift.JPG
raysift.JPG (27.07 KiB) Viewed 940 times
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change Continue button with left click mouse

Post by Tony Li »

Hi,

Assuming you're using Unity UI, set the continue button color's alpha to zero so it's invisible.

If you're using keyboard/gamepad navigation, tick the Unity UI Dialogue UI component's Auto Focus checkbox.

Otherwise, add a UI Button Key Trigger component to the button, and set the Key to Space and the Button to Fire1 (assuming Fire1 is mapped to the left mouse click). If you don't want to set the Button to Fire1, you can add a second UI Button Key Trigger and set the Key to MouseButton0.
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Re: Change Continue button with left click mouse

Post by ichisan »

Hello Tony, thank you for your fast answer.
Like you thought, using UI Button is work. But if I click other button, it still keep me to next dialogue.
How to make it keep on the same dialogue even I click other button (For example save button)?
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Re: Change Continue button with left click mouse

Post by ichisan »

Ah, no problem, I already solved it,
Just added new condition to the script :

bool overOtherButton = EventSystem.current.currentSelectedGameObject != null &&
EventSystem.current.currentSelectedGameObject.GetComponent<UnityEngine.UI.Button>() != null &&
EventSystem.current.currentSelectedGameObject.GetComponent<UnityEngine.UI.Button>() != button;

if(!overButton){
...

Thank you for your help Toni, Cheers....
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change Continue button with left click mouse

Post by Tony Li »

Hi,

Happy to help! I'm glad you got it working with that bit of code.
Post Reply