当前位置:网站首页>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();
}
边栏推荐
猜你喜欢
Microservice architecture debate between radical technologists vs Project conservatives
Scala基础教程--15--递归
Scala basic tutorial -- 20 -- akka
力扣刷题日记/day7/6.30
[发布] 一个测试 WebService 和数据库连接的工具 - DBTest v1.0
Digital "new" operation and maintenance of energy industry
基于NCF的多模块协同实例
整理混乱的头文件,我用include what you use
力扣刷题日记/day6/6.28
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
随机推荐
Li Kou brush question diary /day1/2022.6.23
【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
Scala basic tutorial -- 17 -- Collection
IBM WebSphere MQ retrieving messages
Esp32-c3 introductory tutorial questions ⑫ - undefined reference to ROM_ temp_ to_ power, in function phy_ get_ romfunc_ addr
Scala basic tutorial -- 13 -- advanced function
ESP32-C3入门教程 问题篇⑫——undefined reference to rom_temp_to_power, in function phy_get_romfunc_addr
Nature Microbiology | 可感染阿斯加德古菌的六种深海沉积物中的病毒基因组
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
物联网应用技术的就业前景和现状
【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现
PB的扩展DLL开发(超级篇)(七)
Deleting nodes in binary search tree
Send and receive IBM WebSphere MQ messages
Scala基础教程--18--集合(二)
Halcon模板匹配
. Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
工厂从自动化到数字孪生,图扑能干什么?
力扣刷题日记/day7/6.30
Rookie post station management system based on C language