We just upgraded our project to 2021.2.
We noticed that after the upgrade, the inputsystem’s mouse input became very laggy, I used the input debugger and noticed that the rate at which the mouse events are fired is very low, it looks like there is a loss in the frames.
We rolled back to the old input.GetAxis, there is no issue.
We also tried to down grade the inputsystem to 1.0.2,but the problem persists.
In the early Unity 2021.2beta’s version, ( beta4 maybe?) there is no issue.
We only had this issue with mouse delta, scrolling works fine.
All the axis input is broken. Start to lossing frame…
Things are getting right after I remove my “FixedUpdate DynamicUpdate Swtiching Logic”
void Update
{
if (Mathf.Approximately(Time.timeScale, 0))
{
if (InputSystem.settings.updateMode == InputSettings.UpdateMode.ProcessEventsInFixedUpdate)
{
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsInDynamicUpdate;
}
}
else
{
if (InputSystem.settings.updateMode == InputSettings.UpdateMode.ProcessEventsInDynamicUpdate)
{
InputSystem.settings.updateMode = InputSettings.UpdateMode.ProcessEventsInFixedUpdate;
}
}
}
I’m sorry, but what did you want to do with this exactly? It’s a strange piece of code.
In some low FPS situation fixed update is more stable than update, we have logic to switch between fixed and normal update during runtime. For example, when you are loading/unloading scene, prewarm shader, those actions make main thread block , but fixed update report is much more smooth than update.
What we are doing now is to clamp the maximum delta.
This piece of code doesn’t do what you’re trying to do. Time.timeScale is used to pause the execution.
You’re basically immediately switch to FixedUpdate Input update. Which may or may not be your intention. But a bad idea since you don’t do anything to match the behavior in your code in terms of processing.
You really shouldn’t switch to FixedUpdate unless you are moving your object with physics and I would still argue not to switch Input to FixedUpdate.
And if you have a low fps situation FixedUpdate doesn’t help you. It may run more than once after the clogging, but that doesn’t mean it’s better. You should address the root cause instead. Like make those actions happen over time or under a loading screen or something.
Yes Im tricking…and you are right. But I can do nothing with my main thread block issue, that’s not low fps issues, that’s some very very laggy frame caused by IO. Fixedupdate mode is not usable when time scale is zero. And my english is bad thanks for your patience.