Page 1 of 1

Change Continue button with left click mouse

Posted: Thu Dec 07, 2017 12:57 am
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

Re: Change Continue button with left click mouse

Posted: Thu Dec 07, 2017 9:12 am
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.

Re: Change Continue button with left click mouse

Posted: Thu Dec 07, 2017 5:14 pm
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)?

Re: Change Continue button with left click mouse

Posted: Thu Dec 07, 2017 5:30 pm
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....

Re: Change Continue button with left click mouse

Posted: Thu Dec 07, 2017 7:12 pm
by Tony Li
Hi,

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