Hello, Welcome to Microsoft Q&A,
Please note that HoloLens App is also a UWP app and UWP apps can only access certain file system locations by default. Your app does not have access to most of the file system. For more details, please refer to File access permissions - UWP applications | Microsoft Learn. For UWP apps, we recommend using Windows Storage APIs to access files. Please refer to Create, write, and read a file - UWP applications | Microsoft Learn. And since Unity does not support WinRT APIs, you need to use preprocessing directives on Unity, please refer to WinRT APIs with Unity for HoloLens - Mixed Reality | Microsoft Learn. Here is an example for your reference.
#if ENABLE_WINMD_SUPPORT
using Windows.Storage;
using Windows.Storage.Streams;
#endif
private async void ReadFile()
{
#if ENABLE_WINMD_SUPPORT
Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Storage.StorageFile sampleFile = await storageFolder.GetFileAsync("sample.txt");
string text = await Windows.Storage.FileIO.ReadTextAsync(sampleFile);
#endif
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.