The space key is also the EventSystem's Submit input. If the EventSystem's current selection is on the continue button, the EventSystem will click the button when you press space. But the UIButtonKeyTrigger will
also click the button when you press space. This results in two clicks.
One solution is to remove the UIButtonKeyTrigger and tick the Dialogue Manager's Input Device Manager > Always Auto Focus. This will make sure that the EventSystem keeps the current selection on the continue button.
Another solution is to make a copy of UIButtonKeyTrigger that checks the EventSystem's current selection. If the current selection is UIButtonKeyTrigger's GameObject, then don't do a second click. For example, change the Update method from this:
Code: Select all
void Update()
{
if (Input.GetKeyDown(key) || (!string.IsNullOrEmpty(buttonName) && InputDeviceManager.IsButtonDown(buttonName)))
{
ExecuteEvents.Execute(m_selectable.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.submitHandler);
}
}
to this:
Code: Select all
void Update()
{
if (Input.GetKeyDown(key) || (!string.IsNullOrEmpty(buttonName) && InputDeviceManager.IsButtonDown(buttonName)))
{
if (EventSystem.current.currentSelectedGameObject != this.gameObject)
{
ExecuteEvents.Execute(m_selectable.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.submitHandler);
}
}
}
This assumes that the UIButtonKeyTrigger's Key is set to one of the keys assigned to "Submit" in Unity's Input Manager (space or return).