Opening File Failed Temp/uncompressedData

I’m trying to run an editor script over night that builds asset bundles. Unfortunately, I randomly get the following popup message:

title: Opening file failed

Message: Opening file Temp/uncompressedData failed: the process cannot access the file because it is being used by another process.

Options: Try Again, Force Quit, Cancel

All my file processing is done on my local C drive, so cannot be a network problem. My editor script does not use any multi-threading itself. When I click “Try Again” one second later, it works. Unfortunately that will not solve my problem because I have a lot of data to process and want to let it run overnight. Whenever this message appears, the script pauses.

So my impression from this message is that Unity is multi-threading in the background to create my asset bundles, and when it comes time to save the asset bundle, a thread has not closed their stream to the file yet. I would try to put a two second pause in the code before this happens, but I’m not sure which line causes this popup.

Question: Does anybody know how I can prevent this popup message from appearing? Does anybody know why I’m getting this message? I want it to try again until it works (or at least a few seconds more).

I know this is an old post, but I had this error recently as well. I came across a fix in a different thread post for a similar error. For whatever reason, the real time protection on my virus software caused this issue. As soon as I turned it off, I didn’t get the error anymore. Hope this helps someone else!