1:使用System.Windows.Form dll库实现读取(需要将该库文件导入至Unity)
微软官方教程文档:OpenFileDialog Class (System.Windows.Forms) | Microsoft Docs
读取文件路径和属性API:OpenFileDialog对象
Unity案例代码:(这个是我引用别人的但是找不到他链接了....)
该方法只能用来读取对话窗口中的指定文件类型文件,无法读取文件夹
读取文件夹路径对象:FolderBrowserDialog Class
读取文件夹路径文档和官方案例,写的比我详细多了我就不放我的了:FolderBrowserDialog Class (System.Windows.Forms) | Microsoft Docs
2:使用Comdlg32.dll库文件(较为复杂,不需要引入库文件,只能读取对话窗内的文件)
微软官方教程文档:OpenFileDlg Sample | Microsoft Docs
微软官方Comdlg.h库文档GetOpenFileNameW function (commdlg.h) - Win32 apps | Microsoft Docs
3:使用shell32.dll库文件(较为复杂,不需要引入库文件,可以读取文件夹)
微软官方教程文档:Windows Shell - Win32 apps | Microsoft Docs
使用该库实现另存为和读取文件案例:unity文件选择以及文件夹选择_防止名字重复的博客-CSDN博客_unity 选择文件夹
他写的案例包含了读取和存储以及读取文件夹的实现
4:使用Unity EditorUtility.OpenFilePanel(超简单,但是只能在编辑器使用)
Unity官方文档:EditorUtility-OpenFolderPanel - Unity 脚本 API