It's come up again, my client is feeling it and I've done a bunch of testing, including running the build on another computer and it's happening there. Unity registers the keypress fine, but Dialogue System is reacting weirdly. The problem goes away when when I turn off all the art in the scene and the framerate goes up - we're aware we have to optimize our art but is there any way to fix this in the meantime?
I'm currently testing this with ProximitySelector (as in my older post above) and UIButtonKeyTrigger. In UIButtonKeyTrigger I have the following:
Code: Select all
private void FixedUpdate()
{
if (Keyboard.current.eKey.wasPressedThisFrame)
Debug.Log("E is clicked in FixedUpdate");
}
protected void Update()
{
if (Keyboard.current.eKey.wasPressedThisFrame)
Debug.Log("E is clicked in Update");
if (!monitorInput) return;
if (!(m_selectable.enabled && m_selectable.interactable && m_selectable.gameObject.activeInHierarchy)) return;
if (InputDeviceManager.IsKeyDown(key) ||
(!string.IsNullOrEmpty(buttonName) && InputDeviceManager.IsButtonDown(buttonName)) ||
(anyKeyOrButton && InputDeviceManager.IsAnyKeyDown()))
{
if (skipIfBeingClickedBySubmit && IsBeingClickedBySubmit()) return;
Click();
}
}
Debug.Log("E is clicked in FixedUpdate"); ran 156 times and
Debug.Log("E is clicked in Update"); ran 17 times
In proximity selector everything is in update but
Code: Select all
if(InputDeviceManager.IsKeyDown(useKey))
Debug.Log("InputDeviceManager: " + useKey + " used");
// Runs 17 times
if (IsUseButtonDown())
Debug.Log("UseButtonDown function fired");
// Runs 17 times
if (Input.GetKeyDown(KeyCode.E))
Debug.Log("Input Get Key Down" + " used");
// Runs 156 times
So some update loops appear to be affected by the framerate (InputDeviceManager and UIButtonKeyTrigger) and others (ProximitySelector) are not?