Hello everyone; I’m learning Unity and I, obviously, started with the roll-a-ball tutorial and encountered a weird glitch that wouldn’t let me proceed. Basically, as far as I can tell, I tried some code that MonoDevelop liked about as much as a gunshot wound (I was just trying out some nonsense with GUIText, nothing that should have a permanent effect) and it wouldn’t let me do anything with coding on that project. Specifically, whenever I tried to compile code Unity would give me this error
Moving file failed
Moving Temp/Assembly-CSharp.dll to Library/ScriptAssemblies/Assembly-CSharp.dll:
Access is denied
I deleted the offending code (it was working fine before the changes) and tried again, no luck. Restarting the computer gave me a temporary respite until it pulled its shenanigans again. I thought it might be a permissions issue but the folder has a read only attribute that not even the attrib -r command in admin mode cmd can remove.
Long story short I upgraded to Unity 5 when it came out and started on the space shooter tutorial and nothing’s going wrong. Then I try some extra-curricular activities and try to program in some stuff to delete the spawned shots when they got out of camera range. I had a number of different attempts at using the Destroy command before it pulled the exact same error message on me again. I deleted the code and tried again, this time it worked.
Ignoring what fate was trying to tell me I did what I thought should work and tried to clean up my shots again, the error occurred, and deleting all code that isn’t strictly part of the tutorial hasn’t helped it and now I can’t modify my shot script or player script because I always get the same error message. It should be noted that I never got the code to fully compile, so it never ran in Unity.
Sorry if this should go into the scripts section of the forums, but it doesn’t seem like it’s a problem with the scripts themselves, so I figured that here was the better place. Any ideas on how to get the entire setup to start working properly again?
As a minor update, I restarted my computer and decided to press on and try as hard as I could to simply not write any wrong line of code, since that seemed to be what triggered it before. This worked for a while until I got to a perfectly valid few lines of code, destroying the asteroid on contact with a shot, before I compiled it and went back to Unity, where I got a similar message, except that it relayed that it was successful, before immediately giving me the unsuccessful error message and subsequently rendering all my scripts temporarily useless again.
Same error here, also running Unity5,
I got my error
“Moving Temp/Assembly-CSharp.dll to Library/ScriptAssemblies/Assembly-Csharp.dll: Access is denied”
with only the three equally useless options to “Try Again”, “Force Quit” and “Cancel”.
after restoring a backup previous copy of a project when Unity5 started pretending my first person controller had no collider and could noclip through walls.
Will keep looking elsewhere in forums for an error, there appear to be numerous other hits but for previous Unity versions.
Other hits recommend to disable ‘Realtime protection’ in antivirus, and/or whitelisting/excluding the Unity Project Folders in antivirus, will do that, reboot and see if it works.
Nup, no luck even after reboot.
Disabled Microsoft Security Essentials Realtime Protection AND whitelisted Unity project folder.
Also disabled realtime malware scanner.
Also tried setting my userid as owner for subdir branch (I am owner but still getting access denied), clearing ‘read-only’ checkbox for all subdirs/files (doesn’t stick).
Bit the bullet and got it working by deleting all files and subdirs in the project folder EXCEPT Assets. Unity3d rebuilt the framework by re-importing and recreating metadata, but all project settings were wiped - I reopened my scene ok however, so I’ll see how I go from here.
NOT a solution for everyone, but good enough for my test code.
A warning to those who think restoring backups is a sure thing.
(Found this link which also recommends this technique to only keep Assets folder and let Unity3D recreate Project files and subdirs):
Yes, I can easily move or delete Assembly-Csharp.dll and other related files outside of Unity via Windows Explorer, but that doesn’t solve the problem.
The issue is - even after deleting the entire Temp subdir under the project subdir,
Unity3D recreates a new Temp subdir on startup/project open, then fills Temp with a bunch of files including Assembly-Csharp.dll file (presumably as some form of file cache), then attempts to write from Temp into the project’s Library subdir, and THAT is when a whole bunch of ‘Access Denied’ errors pop up (not just the Assembly-Csharp.dll error).
For example, today after updating an animation asset on the same restored project I thought I had cleaned completely,
I then tried to save scene, but Unity3D blew up with THIS error (no mention of Assembly-Csharp.dll).
I think at this stage I am going to have to trash the entire project and start from scratch -
Thankfully this is just a test project from the Live Training Archive (Merry Fragmas Tutorial), but I have wasted a large # of hrs on it already, so yeah…
I had this problem with some .dll when importing .unitypackage. Updating plugin actually.
My solution:
I imported package to new project without problems. Then imported all files except that one that caused problem in my project, then manually copy it from new project.
Problem was when overwriting that dll i suppose…
The cause of my file access denied issues was actually very simple: Google Drive. Even though I hadn’t told it to include my project files in the file sync, it was still including them anyway. And the very annoying fact was if a file was syncing, access to it was locked on my PC. I disconnected my Drive and all the errors went away. I’ll just have to stick with the web interface, I guess.
Some file from that folder is likely open in another program. This will even include File Explorer / Finder windows in some cases. Close everything you can and try moving the file again.
This was it! a windows explorer was open to my assets folder and it was stopping the specific folder move. I did 20 other folders no issue! Thanks, I would have never thought an explorer window was blocking a file copy!