Error: The process cannot access the file because it is being used by another process.

From time to time, after building scripts I get this error. I didn’t have it before, probably it’s this related to this alpha?

If you want me to provide any additional information, just let me know.

I have to mention that this error cannot be “cleared”, I have to restart the editor every time it occurs.

I also frequently experience this problem in Unity 2020.3.3f1 using Visual Studio 2019. The file that becomes locked is seemingly random and when I do a powershell search for processes locking the file- Unity is the only process shown. So probably a thread or child process that didn’t properly release its’ lock I’d guess.

The only fix is to restart Unity. Happens multiple times a day. 10-15 min to re-open Unity each time. Wild.

Yep. Do you use burst?

I had similar problems outside of unity. This can often also be done with windows indexer lock files.

this can be anything that checks that same file: Dropbox, antivirus, windows indexer… anything that woud check the file for changes basically.

Getting the same issue on 2020.3.26. I suspect it might have something to do with Plastic? Since that is checking for file changes.

I am having the same issue. Also using burst. Using 2021.2.9f1.

This is the same issue as Assembly-CSharp.pdb: The process cannot access... - 1.6.5 we hope has the fix for this bug!

Burst version 1.7.0-pre.1 solved this issue!

very simple delete the meta file of the script file

It happened to me when I deleted the file that was using the script, when I deleted the script it solved :). hope this helps

I was having this problem. It ended up being I had saved my project files in my google drive and it was constantly backing up the files as I was changing them. I turned off my google drive syncing and it fixed the problem. Hope that helps !

In my case, it was windows’ one drive