I am trying to solve this since weeks, googling every single day, I think I tried everything and nothing works.
When I start the game with the inspector visible, it can be any inspector, it just needs a lot of fields drawn, all inputs are delayed for up to 10 full seconds.
Example: I am running around in my scene, take the hands off my keyboard and the player keeps running and moving the mouse with a delay of up to 10 seconds.
While playing, I can press left for a couple seconds, then press and hold right - player continues to go left for <10s then proceeds to go right. It’s just a enormous lag.
The editor does not freeze completely but it ignores (or stacks?) new inputs while rendering the game view at a low framerate (despite the “Stats” showing 200+ fps).
The input is from the original Standard Assets FPS controller, nothing was changed, not the inputs, not the controls or anything.
Profiling the Editor with the Profiler, showed me that the Inspector keeps drawing itself for about 1000 times a frame, causing massive loads of garbage which will also be collected in the very same frame, resulting in extreme lag.
If I hide the Inspector (“Maximise on Play” or just closing it) or select another GameObject with less fields to draw, everything behaves as it should.
Profiler attached to the Editor showed tons of “Material.SetPassFast”, “GC.Alloc”, “EditorGUIUtility.HandleControlID()”, “GUITexture.Draw”, “Transform.GetScene” calls in about 30-40 individual calls of “UIR.ImmediateRenderer”.
As said, it can be ANY inspector - not using any kind of custom inspector here.
So what I tried:
- Completely uninstalling and reinstalling Unity+VisualStudio.
- Using another mouse, because I read it could have something to do with the mouse poll rate.
- Having the GameView in the same Window as Unity (usually it is on my second monitor).
- Deactivating other monitors.
- Unplugging USB xbox controller.
- Updating all drivers and windows.
- Checking every single setting in preferences and project settings.
- Deleting the libary folder.
- Backup my project and deleting 80% of the 40GB files, including Odin, Peek, Rainbow Folders - the lag was still there, so it is none of the custom tools.
- Resetting to default layout.
- Checking every BIOS Setting, excluding Unity from Windows Defender, deactivating almost everything except for unity (task manager, services, autostart, cortana, everything).
- Sending the whole project over to a friend - it runs fine on his machine … after 4h in discord he was still not able to reproduce the lag.
- Deactivating Preferences/General/AutoRefresh, setting Preferences/General/InteractionMode to every available Option.
- Running the Editor with Unity.exe" -force-opengl, this caused some funny artifacts so I knew it was running, but the lag was still there.
I have no idea how to solve this. As Programmer I have to watch variables in the inspector while the play mode is running, hiding the inspector is not an option for me.
Any ideas? I am 99% sure reinstalling windows won’t solve the problem and would just be a huge waste of time.
Unity Version: 2019.3.12f1 (also tested with 2019.3.6f1)
Hardware:
Processor
Intel(R) Core™ i7-5820K CPU @ 3.30GHz
RAM
32 GB
Video Card
NVIDIA GeForce GTX 980 Ti
Operating System
Windows 10, 64-bit
Drive
SSD Corsair Force Series MP510 960GB