Changing InputSystem.updateMode at runtime causes MASSIVE lag spike in both Editor&Build.

Whenever I try to pause my game I get this
9206259--1284348--upload_2023-8-9_15-11-40.png

Changing InputSystem.updateMode at runtime when I pause and unpause causes massive lagspike. But I need to do it, so I don't know how to avoid it. I need my gameplay input running at fixedupdate and I need my UI input running at dynamicupdate.

But I don't get why it's calling TryFindMatchingControlLayout 7300 times on the frame that happens (24B * 7300 = 175KB memory allocations).

9206349--1284363--upload_2023-8-9_16-2-54.png

That's what deep profiling shows.

And it's doing that call 30 more times on the frame updateMode is changed.

Is there not a way for it to simply use the existing controllayout when changing updateMode? Why does it have to look for it again and look for every device.

This is happening at build-time too, not just editor. If trying to deep profile changing updateMode, the build stalls for 3000 milliseconds.

your unity version?? That's what I do,but I dont get Calling tryFindMatchingControlLayout


2023.1 (might've been 2022.3 at the time of this post), but I ended up figuring out a workaround by just setting the Update Mode to to ProcessEventsManually and had my global update manager script call InputSystem.Update() in either FixedUpdate or Update depending on whether the game state is UI or not. Which avoiding having to switch updatemode at runtime entirely.