Hi,
Inside the continue Button from the Standart Dialogue UI, I have a Standard Dialogue Continue Button Fast Forward and a UI Button Key Trigger (Key = Space).
If I click the button manually when the text is using the Text Mesh Pro Typewriter Effect, it automatically completes it instead going to the next conversation node. This is perfect, as its the way I want to have it. However, If I use the Space key while the text is using the Text Mesh Pro Typewriter Effect, it automatically goes to the next Dialogue node from the conversation.
Any idea why is this happening?
Thanks!
UI Button Key Trigger -> Standard Dialogue Continue Button Fast Forward problem.
Re: UI Button Key Trigger -> Standard Dialogue Continue Button Fast Forward problem.
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:
to this:
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).
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);
}
}
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);
}
}
}
Re: UI Button Key Trigger -> Standard Dialogue Continue Button Fast Forward problem.
Hi,
Thank you. It worked!
Thank you. It worked!
Re: UI Button Key Trigger -> Standard Dialogue Continue Button Fast Forward problem.
Great! Happy to help.