使用前需要引入System.IO;这个命名空间
public void GetFiles()
{
//路径
//string path = string.Format("{0}", Application.streamingAssetsPath);
string path = string.Format("{0}", @"D:\SHU170221U3D-09\Lesson14\Assets\StreamingAssets"); //获取指定路径下面的所有资源文件
if (Directory.Exists(path))
{
DirectoryInfo direction = new DirectoryInfo(path);
FileInfo[] files = direction.GetFiles("*", SearchOption.AllDirectories); Debug.Log(files.Length); for (int i = ; i < files.Length; i++)
{
if (files[i].Name.EndsWith(".meta"))
{
continue;
}
Debug.Log("Name:" + files[i].Name);
Debug.Log("FullName:" + files[i].FullName);
Debug.Log("DirectoryName:" + files[i].DirectoryName);
}
}
}