At runtime, Unity WebPlayer is unable to move cache files. Moving file failed - Access is denied.

At launch, my game downloads an AssetBundle. Once the download finishes, it unpacks it, caches it, and proceeds to the game. This has worked fine for approximately a month. I have made no changes to any relevant code recently - I have spent the past few days developing new content/meshes/textures, not coding.

Starting today, for seemingly no reason, I started receiving this error when the AssetBundle finishes downloading:

64151-cache.png

Because the AssetBundle is never unpacked or cached, the game breaks, and I can do nothing.

  • I have not installed any new software.
  • I am running Unity Editor as an administrator.
  • My hard drive has several hundred free GB of space.
  • I have not changed any permissions or added any new users to my machine.
  • I am running a relatively new (<1 month) Win10 install.
  • Everything worked fine for approximately a month before encountering this error. I have not made any significant code changes.
  • OLD VERSIONS OF THE GAME STILL WORK. I can run my build from 3 days ago and everything runs fine. But when I roll back my code to 3 days ago and recompile, it fails.
  • Upgrading the Unity Editor from 5.2.2 to 5.3.2 did not fix this problem.
  • Updating to the latest version of the Unity Web Player did not fix this problem.
  • Disabling Windows Defender (my only antivirus software) and Dropbox did not fix this problem.
  • Manually setting the cache folder to no longer be read-only did not fix this problem. (It automatically reverts back to read-only.)
  • The cache directories are not being indexed by Windows.

I am out of ideas and exasperated. It looks and feels like there is some other software interfering with Unity Web Player’s ability to move things around, but I have no idea what else to try.

I have narrowed this bug down to the specific AssetBundle I was trying to load. Reverting to an older version of the bundle eliminated the issue.

I have no idea what exactly caused the AssetBundle to be problematic. All I did is add a few more textures to it. As far as I know, AssetBundles do not have a filesize limit, and even if they do, the filesize was 6MB (16.4MB uncompressed).

I’m circumventing the issue by simply loading those textures from a local directory instead of an asset bundle, which is something I’ve been meaning to do for a while, anyway.

Still, though, I’m scared to death that this bug is going to come back to haunt me later.

In my case, there was a code issue. The path I provided UnityEditor.AssetDatabase.CreateAsset was bad. As the console shows nothing on force quit, the cause is not obvious.