Version: 2020.2

EditorUtility.OpenFolderPanel

切换到手册
public static string OpenFolderPanel (string title, string folder, string defaultName);

描述

显示“打开文件夹”对话框并返回所选的路径名称。

另请参阅:OpenFilePanelSaveFolderPanel 函数。


打开文件夹面板。

using UnityEditor;
using System.IO;

public class OpenFolderPanelExample : EditorWindow { [MenuItem("Example/Load Textures To Folder")] static void Apply() { string path = EditorUtility.OpenFolderPanel("Load png Textures", "", ""); string[] files = Directory.GetFiles(path);

foreach (string file in files) if (file.EndsWith(".png")) File.Copy(file, EditorApplication.currentScene); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961