Interacting with Response using keyboard/controller
Interacting with Response using keyboard/controller
Hi,
Is there any way to use keys to interact with Responses ?? I want something like ... 1st response will be highlighted and I can use arrow keys to change the option and then another key to confirm. Is this possible ??
Thanks.
Nishant
Is there any way to use keys to interact with Responses ?? I want something like ... 1st response will be highlighted and I can use arrow keys to change the option and then another key to confirm. Is this possible ??
Thanks.
Nishant
Re: Interacting with Response using keyboard/controller
Just an update on things that I have checked .
1. This question is there in FAQs .Its mentioned ' In the Navigation section, tick Enabled. This will let you navigate with keys and gamepads. You can customize the behavior using the other options available in the Navigation section'. However I couldn't find this option in Response Panel ; the only Navigation option that is present is in the button object but it doesnt show any tick mark or other options that answer refers to.
2. I have a feeling that this can be solved with QTE but not sure how that works.
1. This question is there in FAQs .Its mentioned ' In the Navigation section, tick Enabled. This will let you navigate with keys and gamepads. You can customize the behavior using the other options available in the Navigation section'. However I couldn't find this option in Response Panel ; the only Navigation option that is present is in the button object but it doesnt show any tick mark or other options that answer refers to.
2. I have a feeling that this can be solved with QTE but not sure how that works.
Re: Interacting with Response using keyboard/controller
Hi Nishant,
It depends on the GUI system you're using.
If you're using Unity UI, set up Unity's standard keyboard/controller navigation as described on Unity's Navigation page. Then on your dialogue UI tick Auto Focus to automatically highlight the first response. More info is here.
If you're using legacy Unity GUI, follow these steps.
If you're using a different GUI system, please let me know which one. The procedure is different for every GUI system.
It depends on the GUI system you're using.
If you're using Unity UI, set up Unity's standard keyboard/controller navigation as described on Unity's Navigation page. Then on your dialogue UI tick Auto Focus to automatically highlight the first response. More info is here.
If you're using legacy Unity GUI, follow these steps.
If you're using a different GUI system, please let me know which one. The procedure is different for every GUI system.
Re: Interacting with Response using keyboard/controller
Hey Toni,
Yes I am using Unity UI . I tried to set auto-focus but didnt work . Is it because I am locking the mouse cursor in my game ?
Yes I am using Unity UI . I tried to set auto-focus but didnt work . Is it because I am locking the mouse cursor in my game ?
Re: Interacting with Response using keyboard/controller
Hi, this code configure the buttons as Explicit and i can choose response with the stick of the controller or with W,S in the keyboard
Hope this will useful for you
nota: in the response settings of the dialogue system gameobject, i use a button template so dialogueSystem generete all the responses that the Conversation need and then this code configure their navitation and preselect the first one.
Hope this will useful for you
nota: in the response settings of the dialogue system gameobject, i use a button template so dialogueSystem generete all the responses that the Conversation need and then this code configure their navitation and preselect the first one.
Code: Select all
#region Response
public override void ShowResponses (Subtitle subtitle, Response[] responses, float timeout)
{
base.ShowResponses(subtitle, responses, timeout);
if(responses.Length > 0)
SetButtonsNav();
}
public override void HideResponses()
{
dialogue.responseMenu.DestroyInstantiatedButtons();
base.HideResponses();
}
void SetButtonsNav()
{
List<GameObject> buttons = dialogue.responseMenu.instantiatedButtons;
int totals = buttons.Count;
for(int i = 0; i < totals; i++)
{
Navigation n = new Navigation();
n.mode = Navigation.Mode.Explicit;
n.selectOnUp = (i == 0)? buttons[totals-1].GetComponent<Button>(): buttons[i-1].GetComponent<Button>();
n.selectOnDown = (i == totals-1)? buttons[0].GetComponent<Button>(): buttons[i+1].GetComponent<Button>();
buttons[i].GetComponent<Button>().navigation = n;
}
StartCoroutine(SetSelectedGameObject(buttons[0]));
}
IEnumerator SetSelectedGameObject(GameObject o)
{
//we need to wait to the next cicle :( otherwise we go into the same
//update how call the response and get the effect of autoselect.
yield return null;
UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(o);
}
#endregion
Re: Interacting with Response using keyboard/controller
Hey ,
Thanks for that I almost came up with something similar but this is way cleaner . 1 doubt , how am I supposed to bind the keys ?? be it w/s or controller ?
Thanks for that I almost came up with something similar but this is way cleaner . 1 doubt , how am I supposed to bind the keys ?? be it w/s or controller ?
Re: Interacting with Response using keyboard/controller
in the unity input settings you can configure this kind of stuff normaly is autoconfigure to use WS to up down in the keyboard for the devices i use incontrol how implement the same settings of unity but overriding to the controller.
hope this help you
hope this help you
Re: Interacting with Response using keyboard/controller
I am aware of Input Manager . I wanted to know how can I tell the compiler to SelectOnUp when i press W or is that done automatically ? Maybe it does that when focus is on any button ?? I cant get auto-focus to work either ; probably thats why I cant navigate around.
Re: Interacting with Response using keyboard/controller
Please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look, too.
Re: Interacting with Response using keyboard/controller
Thanks will do so as a last resort .