Search Unity

Unity IOS Build error – Access to the path is denied.

Discussion in 'iOS and tvOS' started by FierceFun, Nov 27, 2019.

  1. FierceFun

    FierceFun

    Joined:
    Jan 18, 2017
    Posts:
    12
    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 ?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,740
    Are you building on a Mac? That path does not look right.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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?
     
  4. FierceFun

    FierceFun

    Joined:
    Jan 18, 2017
    Posts:
    12
    Sorry , I meant to say I am on Windows...............creating an Xcode build.......... I then bring that to my Mac
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The error may be correct.
     
  6. FierceFun

    FierceFun

    Joined:
    Jan 18, 2017
    Posts:
    12
    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
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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...
     
  8. FierceFun

    FierceFun

    Joined:
    Jan 18, 2017
    Posts:
    12
    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.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you try my suggestions?
     
  10. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    54
    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 .?
     
  11. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
    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.
     
    Yerbol05 likes this.
  12. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
    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
     
    Last edited: Mar 6, 2020
    hoomanrow likes this.
  13. hoomanrow

    hoomanrow

    Joined:
    Nov 10, 2018
    Posts:
    2
    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?
     
  14. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    113
    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.
     
  15. dsb7

    dsb7

    Joined:
    Jan 19, 2018
    Posts:
    7
    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?
     
    triple_why likes this.
  16. winio

    winio

    Joined:
    May 9, 2017
    Posts:
    1
    Same here
     
  17. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    80
    And the same here, I thought development for Android was painful, but dear lord, does IOS take the cake.
     
    Aadee123 likes this.
  18. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    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.
     
  19. Imhotebkin

    Imhotebkin

    Joined:
    Feb 10, 2015
    Posts:
    18
    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:)
     
    triple_why likes this.
  20. triple_why

    triple_why

    Joined:
    Jun 9, 2018
    Posts:
    47
    Yes I confirm this. And selecting a user local path (e.g. C:\Users\<user>\Documents\blabla) helps as well.
     
  21. Armegalo

    Armegalo

    Joined:
    May 14, 2018
    Posts:
    30
    I had same problem, access denied to iOS build folder that it had then deleted. Changed my build destination to a user local path as described above and it worked a treat. Weird, all my other builds are fine, it's just the iOS build
     
  22. j4n

    j4n

    Joined:
    Nov 30, 2017
    Posts:
    8
    Same issue. Something seems badly broken about the iOS build process.
     
  23. mgk9718

    mgk9718

    Joined:
    Jan 22, 2018
    Posts:
    1
    I got a solution

    cd /Applications/Unity
    chmod -R 777 PlaybackEngines
     
  24. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    44
    Same here with 2019.3.11f. Is this already fixed in a newer version?
     
  25. JaNow

    JaNow

    Joined:
    Mar 27, 2020
    Posts:
    1
    I fixed it by unchecking Development Build in the build options!
     
  26. FireDiver98

    FireDiver98

    Joined:
    Sep 22, 2018
    Posts:
    1
    2019.3.15f1 @Win10 here, problem still exists with iOS build target from time to time, even when creating a Folder from the Build Menu. Running as administrator did not solve the problem, as previously mentioned
     
  27. Ibanezlespaul

    Ibanezlespaul

    Joined:
    Sep 11, 2017
    Posts:
    2
    Happens in 2019.2.11f, could build to my window user document folder though.. :)
     
  28. YoNeyers

    YoNeyers

    Joined:
    Feb 10, 2017
    Posts:
    32
    i got the same problem in mac , unity 2018.4.22 LTS
     
  29. Yerbol05

    Yerbol05

    Joined:
    Apr 24, 2020
    Posts:
    3
    PC restart helped me.
     
  30. krossman

    krossman

    Joined:
    Apr 26, 2020
    Posts:
    6
    I changed the path to C: \ users \ name_users \ my documents and the problem is solved.
    windows 7, Unity 2020.1.5f1 (64-bit).
    triple_why, thanks

    You can also build in a folder with the game.
     
    Last edited: Oct 19, 2020
    iriegusto likes this.
  31. idontcareforunity

    idontcareforunity

    Joined:
    Feb 21, 2019
    Posts:
    3
    I got the same problem on Windows 10, Unity 2019.4.11f1. It is solved when I changed the build directory.
     
  32. zxubian

    zxubian

    Joined:
    Oct 22, 2015
    Posts:
    14
    Still happening with 2019.4.16f1 LTS...
    @JeffDUnity3D, could you confirm whether or not this is even being tracked as a bug by Unity?
     
  33. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Have you submitted a bug report?
     
  34. iriegusto

    iriegusto

    Joined:
    Nov 21, 2020
    Posts:
    20
    after many, many hours & trying countless solutions, this one worked. thank you!!!
     
  35. inchgames

    inchgames

    Joined:
    Jul 8, 2018
    Posts:
    8
    On Mac, if you build to Downloads as me, simply delete folder and create new one
    sudo rm -rf Downloads
    mkdir Downloads
    chmod 777 Downloads
     
  36. zero4444

    zero4444

    Joined:
    Aug 14, 2017
    Posts:
    7
    Changing the path to "C:\Users\myname\Documents\unity-build-ios", doesn't work on "Windows 10".
    It gets deleted everytime.
    Only solution for is to reboot. Unity 2020.3.13f only allows 1 IOS build.
    Any other solution?
     
  37. inchgames

    inchgames

    Joined:
    Jul 8, 2018
    Posts:
    8
    Make sure that you always select a specific folder inside not the whole Documents or Downloads, manually pick the folder
     
  38. ooosssaaa8

    ooosssaaa8

    Joined:
    Aug 10, 2022
    Posts:
    1
    Access to the path "C:\" is denied.
    System.IO.Directory.CreateDirectoriesInternal (System.String path) (at <437ba245d8404784b9fbab9b439ac908>:0)
    hi ive been trying to solve this Error for days :( iam using windows 10
    and unity 19.3