Unity hangs upon compiling scripts.

I have been using Unity for two weeks now, and this issue has only started since yesterday.

Whenever Unity begins recompiling/refreshing C# files, whether it be from a script edit or running a build, it would do the compiling for around 2-3 seconds and then hang. Unity is totally unresponsive and the only way to kill it is by using task manager.

Some possible solutions I have tried:

  • Run unity as admin.
  • Changed project hard drive.
  • Created new project and imported old code to new project.

Anyone have any ideas? Thanks.

Did you add some weird/broken code yesterday? If it hangs on your code specifically - and not just any code - then there might be something breaking the compiler in there. Weird dll’s or something?

Nope, I didn’t add any new DLLs or external code yesterday. I am using TMPro and Photon PUN.

So this stopped happening now. I cleaned my computer for any dust but other than nothing else. I made sure to wait between Unity compiling scripts and clicking on the interface and it’s fine now.