I created a blank Unity project, built it for UWP and added one line of code:
File.ReadAllText(@"C:\\Users\jtth\Desktop\cntrlRcrds-013.txt");
And I get back,
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.ni.dll
Additional information: Access to the path 'C:\Users\jtth\Desktop\cntrlRcrds-013.txt' is denied.
I have:
Checking Firewall
Made sure all folders/files in path weren't Read Only
Changed path to root C:\
Tried path into the Apps data folder
Ran Unity & VS as admin
Restarted my computer
What gives? Please advise.
NOTE: I am running this on 'Local Machine', not on the HoloLens. The HoloLens has a variety of access permission issues itself.
UWP is very sandboxed, you can't really access most folders or files through the application...
Try
File.ReadAllText(System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "cntrlRcrds-013.txt"));
And put the file in the location that Windows.Storage.ApplicationData.Current.LocalFolder.Path points to.
Hope this helps.