Showing results for 
Search instead for 
Did you mean: 

Access to the path denied error in Unity 2021.2.4f1 on Windows 10 Pro (20H2)

Level 2

I have 70 build errors when attempting to build to my Oculus Quest 2 that are of the following type:



Building Library\Bee\artifacts\Android\Features\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule-FeaturesChecked.txt failed with output:
System.UnauthorizedAccessException: Access to the path 'C:\Users\macht\OneDrive\Documents\GitHub\VRTest\Library\Bee\artifacts\Android\Features\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule-FeaturesChecked.txt' is denied.
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at System.IO.File.WriteAllText(String path, String contents)
   at NiceIO.NPath.SystemIOFileSystem.File_WriteAllText(NPath path, String contents)
   at NiceIO.NPath.WindowsFileSystem.File_WriteAllText(NPath path, String contents)
   at NiceIO.NPath.WindowsFileSystem.File_WriteAllLines(NPath path, String[] contents)
   at NiceIO.NPath.WriteAllLines(String[] contents)
   at PlayerBuildProgramLibrary.FeatureExtractor.Run(CSharpActionContext ctx, Boolean ignoreSystemDlls)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()



This applies to many features. I have both the Oculus XR Plugin and XR Plugin Management modules installed in my project through the Unity package manager. This is after going through Enable Device for Development and Testing | Oculus Developers to learn how to deploy an Oculus app to my headset. I am able to detect my headset just fine, and my adb program has been installed even though I'm not able to run it from the command line. It appears the problem could be due to not being able to select Oculus as my XR plugin provider as shown below:
Cannot select Oculus due to grayoutCannot select Oculus due to grayout
Has anyone else had these sorts of issues when going through Configure Unity Settings | Oculus Developers?