Unity IOS Build error – Access to the path is denied

UnauthorizedAccessException: Access to the path “C:/UnityXcodeProjects/” is denied.

System.IO.Directory.CreateDirectoriesInternal (System.String path) (at 437ba245d8404784b9fbab9b439ac908>:0)

Had an Android project working with IAP and Ads. Changed to Unity and keep getting the above error. Getting this error, no matter what I do. Removed most packages . Still there. Wasted days on this ……………

Anyone got a work around ?

Are you building on a Mac? That path does not look right.

Perhaps the error is correct, what have you tried? First thing I might suggest is to try running Unity as an Administrator. As mentioned, are you on Windows or a Mac?

Sorry , I meant to say I am on Windows…creating an Xcode build… I then bring that to my Mac

The error may be correct.

Am I ok to create my Xcode build on my PC and then open that Xcode build on my Mac…or should I do it all on my Mac. will a Mac open a Unity project created on Windows ? thanks

So you’re changing subjects now. I might suggest first things first. If you have a Mac, then do all your work on your Mac. Why transfer? But back to the original problem…

I will try the latest version of Unity (2019.3f) released today. So we have an Android game which was developed on a PC and we are porting it to IOS. So we switched platform to IOS and tried to build and got that error above. I have seen 2 other people report the issue… it seems to be something to do with the Package Manager and paths.

Did you try my suggestions?

var OUTPUT_PATH = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var dirPath = Path.Combine(OUTPUT_PATH, “Abc”);
Debug.Log(Directory.Exists(dirPath));
// If the directory does not exist, then create it
if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath);
// Debug.Log(recordingDirectory);

Its working fine on editor and development build but with Mac App Store build I’m getting
unauthorizedaccessexception: access to the path is Denied
how to fix this .?

We are consistently having the same error when building for iOS from Windows (unity 2019.3.1f1).
I create the build target folder, select it, then unity deletes it and says access is denied

Tried already launching the Hub as Administrator (as suggested by @JeffDUnity3D ). Trying to launch the editor version directly opens the hub.

1 Like

Restarting the PC allowed me to build once.
I guess some file lock at some point was the culprit. weird… (really weird Unity managed to delete the folder)

But then it happens again. I managed to do 1 build, but then the error comes back with every folder name I pick… It definitely has to be some error from Unity

1 Like

I have the same issue, running the latest Unity (2019.3.5f1). I tried running Unity hub as the admin, it didn’t help. I’m on Windows, and can normally publishing to iOS from there. Except I keep getting that error, and then it deletes the folder. Is there any workaround?

I was getting this, but then it works when I create the initial directory from within unity editor when selecting a build location, rather than choose a location I created myself.

I have the same issue running 2019.3.6.

UnauthorizedAccessException: Access to the path “C:/dev/unity/projects/EmptyProject/ios” is denied.
Build completed with a result of ‘Failed’
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors

I am running into this error on a Windows 10 machine, build 1909.

This happens when I create a new project, then try to build for iOS. The build proceeds for a while, creating some files in the specified output directory, then runs into this error and deletes the directory.

I can usually build without an error after I reboot, at least once, sometimes twice. But then it starts failing after that.

Here are the details of what I have tried so far:

I can get it to happen by creating a new project, then trying to build for iOS into an empty directory. I have reproduced it in the following versions:
2019.3.6
2019.3.3
2019.2.21

I have tried it in 2019.1.10 and it builds fine.

For version 2019.3.6 I’ve tried:
Building to two different local drives with wide open permissions. There is plenty of disk space available on each volume. It fails.

I have two nearly identical machines installed at two different locations, with nearly the same software installed on each. 2019.3.6 works fine on one, but not the other.

On the machine that fails:

I have booted into safe mode and tried the build. It fails.

Under normal boot scenario, I have shut off all startup items, shutoff Windows defender and firewall, and it still fails.

I even went through task manager, comparing machine to machine and killing any processes on the failing machine that weren’t running on the working machine. It still failed.

The working machine has build 1903 of Windows 10, and the failing machine has build 1909 of Windows 10. Unfortunately I can’t rollback the 1909 version because I updated it more than two weeks ago (Windows won’t allow rollbacks after a certain period of time).

I’m thinking it’s something in my environment that is either just outright causing the problem or triggering a bug in Unity. But I can’t isolate it.

So right now I’m stuck rebooting every time I want to build for ios. It’s a bit of a drag.

Anybody out there run into this and find a solution or a workaround? (besides rebooting every time I want to build)

Can anybody at Unity help?

1 Like

Same here

And the same here, I thought development for Android was painful, but dear lord, does IOS take the cake.

1 Like

And same here: “UnauthorizedAccessException: Access to the path “D:/Unity/BrickMiner/Xcode” is denied.”

I tried every suggestion I see, including reboot, but none of them worked.

Encountered the issue, this can be fixed by launching everything as admin or creating the folder you want to build to from Unity, when you select the build folder. This is a windows access issue, reboots have nothing to do with it:)

1 Like

Yes I confirm this. And selecting a user local path (e.g. C:\Users<user>\Documents\blabla) helps as well.