Unity Freezes Every Few Seconds

While Visual Studio is running, Unity freezes over time.

Even if I am just right-clicking and dragging the mouse, it periodically stops for about 2 seconds.
Over time, the time to stop becomes longer and the term that occurs becomes shorter.

I don’t know what the reason is.
Do you know the solution?

Well you can see that it is not the scripts, rendering or anything like that, its under “other” which is using all your cpu. I’m also quite new to unity and I’m not sure if this cpu usage includes the whole pc’s usage or just unity’s if the whole pc’s it maybe something do with a program you are running in the background. If this is not the answer, try make a new project and see if the lag carries over.

Possible solution: I had this same problem - on playing the scene in the editor, it would run for around 7 seconds, then freeze/lock for about 5 seconds, then repeat this cycle. The culprit for me was Sophos antivirus software. If disabled, Unity ran normally without freezing. I was so relieved to have found the problem I haven’t investigated why this is happening, but my best guess is the record files (simple text files) I’m writing to are being scanned as they update and this is holding things up.