public void GetFiles()
{
string path = "Assets/Resources/OK_Mesh/";
//string path = string.Format("{0}", @"C:\Users\USER\Desktop\JXBWG\Assets\StreamingAssets");
//获取指定路径下面的所有资源文件
if (Directory.Exists(path))
{
DirectoryInfo direction = new DirectoryInfo(path);
FileInfo[] files = direction.GetFiles("*");//只查找本文件夹下
FileInfo[] files = direction.GetFiles("*", SearchOption.AllDirectories);//查找本文件夹和所有子文件夹
for (int i = 0; i < files.Length; i++)
{
//忽略关联文件
if (files[i].Name.EndsWith(".meta")|| files[i].Name.EndsWith(".mesh"))
{
continue;
}
Debug.Log("文件名:" + files[i].Name);
Debug.Log("文件绝对路径:" + files[i].FullName);
Debug.Log("文件所在目录:" + files[i].DirectoryName);
}
}
}
unity 找到文件夹下所有子文件夹的文件
最新推荐文章于 2024-04-15 21:28:03 发布