Hi, In my Game I can't open the NativeFile picker. I created a seperate Visual Studio project and followed this tutorial. The main code to open the FilePicker is: Code (CSharp): #if NETFX_CORE public async void OpenFilePicker() { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.List; picker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".png"); var file = await picker.PickSingleFileAsync(); if (file != null) { this.onFileSelected?.Invoke(file.Name); } } #endif } If I build the Project and try to access the FilePicker I got the following error: I hope someone could help me.
OpenFilePicker needs to be called on the UI thread. See this post for details: https://forum.unity.com/threads/how-to-show-native-file-picker.381528/
what is ShowOpenPanel input? public static string ShowOpenPanel(bool includeFiles, bool includeDirectories) { Application.InvokeOnUIThread(async () => { var filePicker = new FileOpenPicker(); filePicker.FileTypeFilter.Add("*"); var file = await filePicker.PickSingleFileAsync(); }, false); return string.Empty; }