kingBook

导航

Unity 获取指定资源目录下的所有文件

string path="Assets";//Assets/Scenes
if(Directory.Exists(path)){
	DirectoryInfo directoryInfo=new DirectoryInfo(folderPath);
	FileInfo[] fileInfos=directoryInfo.GetFiles("*",SearchOption.AllDirectories);
	for(int i=0;i<fileInfos.Length;i++){
		if(fileInfos[i].Name.EndsWith(".meta"))continue;
		if(fileInfos[i].Name.EndsWith(".unity")){
			Debug.Log("Name:"+fileInfos[i].Name);
			//Debug.Log( "FullName:" + fileInfos[i].FullName );  
			//Debug.Log( "DirectoryName:" + fileInfos[i].DirectoryName );  
		}
	}
}

posted on 2019-03-15 10:45  kingBook  阅读(4873)  评论(0编辑  收藏  举报