Hi Tony,
I have a question and an issue to consult you on concerning response menus.
1. Is there any way I can add a delay AFTER the response menu appears but BEFORE any of the options become selectable/chooseable? Basically, I want players to be able to have a grace period if they're spamming through dialogue to be notified that a response menu has appeared, prompting their input. As it stands, it's easy to accidentally choose the first selectable option when spamming continue as the response menu options are immediately chooseable when it appears.
2. I'm having a strange issue with my response options (buttons) appearing to deselect themselves if I continue too quickly from the previous dialogue panel. Basically, if I spam continue through my dialogue to bring up the response panel, the first option will appear selected for a fraction of a second, and then immediately de-select itself, or at least it APPEARS that way. If I were to press continue again, the seemingly deselected option is chosen, and the dialogue continues as designed. If I were to try and select a different option by pressing down, the 2nd option would become selected without issue.
I noticed that, when selecting the Dialogue Manager gameobject and observing the components being added live, the issue occurs if I continue to the response menu before a Sequencer component is removed. If I wait for the component to be removed before continuing, it works fine. If I speed ahead, it seems the removal of the Sequencer component causes the issue. This is all purely conjecture, but I thought it worth mentioning.
I can avoid this issue if I add a slight time delay after the previous dialogue before the response panel, or just wait before continuing to the response panel.
Some of my settings:
Dialogue System 2.2.4
Subtitle Chars Per Second: 40 (matches my typewriter)
Continue Button: Always
Default Sequence: Delay({{end}})
(The other sequences are default as well)
Any guidance on why this is happening and how I might fix it, and if there's a solution to my first question, would be greatly appreciated as always!
Thanks!
Response Menu Interactivity delay, focus issue
Re: Response Menu Interactivity delay, focus issue
Hi,
If you add this script to the Dialogue Manager, it will turn off Unity UI's EventSystem for a duration (default 1 second) when the menu appears.
ResponseMenuInputDelay.cs
It will not stop UI Button Key Trigger components if you're using them to map hotkeys to response buttons. But it will stop mouse clicks and presses of the EventSystem's Submit input (e.g., spacebar or gamepad 'A' button).
For the buttons deselecting themselves, try ticking the Dialogue Manager's Input Device Manager > Always Auto Focus. It may also help to set the response menu panel's Refresh Selectables Frequency. Set Focus Check Frequency to a non-zero value. On this frequency in seconds, the menu will make sure that one of its buttons is selected (e.g., in case you mouse click elsewhere).
If you add this script to the Dialogue Manager, it will turn off Unity UI's EventSystem for a duration (default 1 second) when the menu appears.
ResponseMenuInputDelay.cs
Code: Select all
using UnityEngine;
using UnityEngine.EventSystems;
using PixelCrushers.DialogueSystem;
public class ResponseMenuInputDelay : MonoBehaviour
{
public float delayInputSeconds = 1;
private EventSystem eventSystem;
void OnConversationResponseMenu(Response[] responses)
{
eventSystem = EventSystem.current;
if (eventSystem != null)
{
eventSystem.enabled = false;
Invoke("EnableEventSystem", delayInputSeconds);
}
}
void EnableEventSystem()
{
if (eventSystem != null) eventSystem.enabled = true;
}
void OnConversationEnd(Transform actor)
{
EnableEventSystem(); // Failsafe in case conversation ends before menu has enabled it.
}
}
For the buttons deselecting themselves, try ticking the Dialogue Manager's Input Device Manager > Always Auto Focus. It may also help to set the response menu panel's Refresh Selectables Frequency. Set Focus Check Frequency to a non-zero value. On this frequency in seconds, the menu will make sure that one of its buttons is selected (e.g., in case you mouse click elsewhere).
Re: Response Menu Interactivity delay, focus issue
That component works perfectly! Thank you!
If left at one second, it also fixes my other issue, since it doesn't gain focus until after the problematic event causing its loss.
I think we'll move forward with it at one second, but will continue to try and monitor what's causing the problem. I should also mention we're using Rewired, if that makes a difference. We didn't have an Input Device Manager on the Dialogue System object, but even after adding one and choosing "Always Auto Focus" it didn't seem to make a difference. Focus Check Frequency by default was non zero (0.001) but even messing with that didn't seem to change anything.
Thanks again!
If left at one second, it also fixes my other issue, since it doesn't gain focus until after the problematic event causing its loss.
I think we'll move forward with it at one second, but will continue to try and monitor what's causing the problem. I should also mention we're using Rewired, if that makes a difference. We didn't have an Input Device Manager on the Dialogue System object, but even after adding one and choosing "Always Auto Focus" it didn't seem to make a difference. Focus Check Frequency by default was non zero (0.001) but even messing with that didn't seem to change anything.
Thanks again!
Re: Response Menu Interactivity delay, focus issue
Glad it's working now.