Error: Can't find a folder when doing a build

when I try to do a buil I get an error:

UnauthorizedAccessException: Access to “Library / BuildPlayerData \ Editor” path is denied.
System.IO.Directory.Delete

I already looked for the files and there is nothing in that folder
please help

A file may be locked, have you tried rebooting?

I’m having the same problem, tried rebooting already and that didn’t change anything

Try manually deleting that folder. Another reason, your project path might be too long if you’re on Windows

5 Likes

I just got this problem as well. :frowning:

EDIT: Deleting the ‘player’ and ‘editor’ folder fixed it!

6 Likes

“Deleting the ‘player’ and ‘editor’ folder fixed it!” Thank you

3 Likes

Had this error and this appears to fix the issue, any reason as to why it happens? I was able to build before but now everytime I build I get this, so wasn’t from the beginning

2 Likes

deleting these folders worked. thanks

1 Like

Where is the folders?

it worked by deleting the whole BuildPlayerData folder (it can be found in the root of the project/library)

simply deleting the Library folder in the repository root
was all that was required for me to fix this build problem

Deleting “BuildPlayerData” worked for me. Since the error was:
UnauthorizedAccessException: Access to the path "Library/BuildPlayerData\Editor" is denied. UNITY

Hi,

I get this issue every time I try to compile webgl. It will work if I delete the library folder but my issue is, why do i have to delete the folder? I’ve watched countless videos and they don’t have this problem. What am I doing differently? I’ve tried setting the permissions on the folder so that anyone can access them; and I’ve tried opening both Unity hub and Unity in administrator mode. Any suggestions? This is driving me mad.

No idea if it helps troubleshoot, but I just got this error doing the Unity Junior programmer path with their “mod the cube” project, and started getting it in my other projects now. Deleting the folder in question totally helped though, so thanks to those above!

Actually I lied. It failed too, but this time on a different folder (IL2CPP). I ended up exporting the assets as a package and starting a completely new project, importing the package, being careful to also import the webgl package before trying to publish (I messed this up on the last one, mayeb that was part of the issue?), and then publishing. This time it worked!

for me it happened when I added this folder to Google Drive to sync… not sure if that was the cause but it’s what I did… right now I am deleting the rebuilding the library folder, deleting playerbuilddata folder did not work for me

2 Likes

I also started having this issue upon starting to sync the folder with Google Drive. Anyway I can sync it and not have this happen?

@ncho You can check my solution, it worked for me. I hope it works for you too.

Same here. I started using google drive desktop to backup my projects recently and I also started getting these same issues.
I was just trying to built webgl and getting that error. My error title was same but it was a directory about a IL2CPP backend scripting.

SOLUTION: here is what i did:

  1. I uninstalled google drive desktop
  2. Restarted my computer
  3. Delete the ‘Library’ folder under the unity project folder.
  4. Open the project again (you have to open the project again so that unity generates Library folder again)
  5. Build the project again. It builds. (problem solved)

The reason why I deleted the whole library folder is that I realized if I delete the buildplayer folder (or any folder in your case) it it gives another error. It was just like a loop I was not finding the solution. So I thought maybe it was because of some other files in library that affects these build files and make bug. So after deleting the whole Library and opening the project again solved my issue. I will copy my solution and share in other forums as well. This problem was a total headache, I’m glad I was able to solve.

You can delete the Library folder. No problem. It is a generated folder you can ignore it and safely delete it. Unity will generate that Library folder again when you open the project.

Thanks for this it’s working now !