【Unity编辑器扩展】获取Assets下选中文件夹目录

 var dir = "Assets";
            foreach(var obj in Selection.GetFiltered(SelectionMode.Assets))
            {
                var path = AssetDatabase.GetAssetPath(obj);
                if (string.IsNullOrEmpty(path))
                    continue;
                if (System.IO.Directory.Exists(path))
                    dir = path;
                else if (System.IO.File.Exists(path))
                    dir = System.IO.Path.GetDirectoryName(path);
            }

你可能感兴趣的:(【Unity编辑器扩展】获取Assets下选中文件夹目录)