Error Build

Hey Guys!
I’m finishing my first game and when I create the build I got some errors:

UnauthorizedAccessException: Access to the path “C:\Users\ramon\OneDrive\Documentos\Alura\Unity\Unity Parte 2\Zumbi Park 2\Library\Il2cppBuildCache\WebGL\additionalCppFiles” is denied.
System.IO.Directory.Delete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.Delete (System.String path, System.Boolean recursive) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:365)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:913)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <55729f52d042492e9efc384182ae2feb>:0)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)
Build completed with a result of ‘Failed’ in 20 seconds (20315 ms)
UnityEngine.GUIUtility: ProcessEvent (int,intptr,bool&)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <55729f52d042492e9efc384182ae2feb>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <55729f52d042492e9efc384182ae2feb>:0
UnityEngine.GUIUtility: ProcessEvent (int,intptr,bool&)

does anyone have an idea what it could be?

Thanks!

Are you using one drive or some kind of sync service?? I don’t think those ever work properly with something as active against the filesystem as Unity is.

If you need to back stuff up, use source control such as git.

I moved to another folder outside of that Onedrive shit but it still has these errors.

Make a new blank project, one scene, test your Unity installation to be able to build.


I have exact same problem. I also use google drive desktop and I saw that it might be an issue. Because someone having the same issue and the google drive desktop is causing the issue.
https://support.google.com/drive/thread/136303349?hl=en
Do you use google drive desktop as well?

Never. It’s explicitly not supported by Unity, and given how Unity detects changes of underlying assets, using a sync service is inviting disaster on your project database.

Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

As far as configuring Unity to play nice with git, keep this in mind:

https://discussions.unity.com/t/736093/3

Here’s how I use git in one of my games, Jetpack Kurt:

https://discussions.unity.com/t/807568/3

Using fine-grained source control as you work to refine your engineering:

https://discussions.unity.com/t/826718/2

Share/Sharing source code between projects:

https://discussions.unity.com/t/719810/2

Setting up an appropriate .gitignore file for Unity3D:

https://discussions.unity.com/t/834885/5

Generally setting Unity up (includes above .gitignore concepts):

https://thoughtbot.com/blog/how-to-git-with-unity

It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It’s simply ridiculous not to back up.

“Use source control or you will be really sad sooner or later.” - StarManta on the Unity3D forum boards

@doctorbasilio
Same here. I was using google drive desktop to backup my projects and I also started getting these same issues.
I was just trying to built webgl and getting that error. My error title was same Access to the path… 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.