I’ve had a problem for several months using the new input systems, where after entering Play mode for the second or more times, after ~10-20 seconds the input system will stop updating for several seconds. Restarting the editor temporarily fixes the issue.
I’m currently using Unity 2019.3.2f1, input system package preview.5-1.0.0. Note that it has occurred for the last few Unity and package versions.
- Enter Play mode.
- Input works as normal.
- End Play mode.
- Enter Play mode again.
- Input works as normal.
- After ~10-20 seconds, inputs are frozen, causing held key presses to remain held.
- After several more seconds, play continues as normal.
As I’m in an ECS project and using addressables, I’m not using any of the input system’s provided monobehaviours, but instead use my own simple manager monobehaviour.
This is how I’m listening for devices:
private void Awake()
{
InputUser.listenForUnpairedDeviceActivity = 1;
InputUser.onUnpairedDeviceUsed += InputUser_onUnpairedDeviceUsed;
}
And when a device is detected:
public void Initialize(InputDevice inputDevice, InputActionAsset inputActionAssetPrefab)
{
var user = InputUser.PerformPairingWithDevice(inputDevice);
m_InputActionAsset = Object.Instantiate(inputActionAssetPrefab);
m_Map = m_InputActionAsset.FindActionMap("Player");
user.AssociateActionsWithUser(m_Map);
m_MoveAction = m_Map.FindAction("Move");
m_UseAction = m_Map.FindAction("Use");
m_BackAction = m_Map.FindAction("Back");
m_Map.Enable();
}
I’ve tried toggling the scene/domain editor options and toggling burst, neither of which affect the issue. During the issue, the game does not stop or lag at all - only the input system stops updating.
Note: as a separate issue, when not reloading both scene and domain, I need to call a internal function, otherwise repeated plays do not register any devices whatsoever.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void RunOnStart()
{
var t = typeof(InputUser).GetMethod("ResetGlobals", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
t.Invoke(null, null);
}
Thanks