当前位置:网站首页>Unity编辑器扩展C#遍历文件夹以及子目录下的所有图片
Unity编辑器扩展C#遍历文件夹以及子目录下的所有图片
2022-07-04 17:39:00 【charlsdm】
下边是我自己写的编辑器扩展关于遍历文件夹下边以及子目录下的所有图片,仅提供参考
[MenuItem("编辑器扩展关于图集/C#遍历文件夹以及子目录下的所有图片")]
static void RefreshAllPicture()
{
string[] DebugAllImage = new string[] {
};
DebugAllImage=KnowAllPicture();
}
public static string[] KnowAllPicture()
{
List<string> liststring = new List<string>();
string myfolderPath = "PicTureFolder";
string path = Path.Combine(Application.dataPath, myfolderPath);
var images = Directory.GetFiles(path, ".", SearchOption.AllDirectories).Where(s => s.EndsWith(".png") || s.EndsWith(".jpg"));
foreach(var i in images)
{
var str = i.Replace(Application.dataPath, "");
var strpath = str.Replace("\\", "/");
strpath = "Assets" + strpath;
liststring.Add(strpath);
}
foreach(var item in liststring)
{
Debug.Log($"ITem:{
item}\n");
}
return liststring.ToArray();
}
边栏推荐
- 启牛开的证券账户安全吗?
- [go ~ 0 to 1] read, write and create files on the sixth day
- Build your own website (15)
- repeat_P1002 [NOIP2002 普及组] 过河卒_dp
- 资料下载 丨首届腾讯技术开放日课程精华!
- 工厂从自动化到数字孪生,图扑能干什么?
- How to open an account is safe,
- Halcon template matching
- Li Kou brush question diary /day7/2022.6.29
- 6.26cf simulation race e: solution to the problem of price maximization
猜你喜欢
随机推荐
奥迪AUDI EDI INVOIC发票报文详解
C#实现定义一套中间SQL可以跨库执行的SQL语句(案例详解)
[opencv introduction to mastery 9] opencv video capture, image and video conversion
整理混乱的头文件,我用include what you use
未来几年中,软件测试的几大趋势是什么?
Scala基础教程--15--递归
From automation to digital twins, what can Tupo do?
李迟2022年6月工作生活总结
2022健康展,北京健博会,中国健康展,大健康展11月13日
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
问下各位大佬有用过cdc直接mysql to clickhouse的么
Halcon模板匹配
Microservice architecture debate between radical technologists vs Project conservatives
Esp32-c3 introductory tutorial questions ⑫ - undefined reference to ROM_ temp_ to_ power, in function phy_ get_ romfunc_ addr
Scala basic tutorial -- 12 -- Reading and writing data
Other InterSystems%net tools
Li Kou brush question diary /day7/2022.6.29
How is the entered query SQL statement executed?
C语言打印练习
力扣刷题日记/day2/2022.6.24