当前位置:网站首页>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();
}
边栏推荐
- Scala基础教程--14--隐式转换
- 2022健康展,北京健博会,中国健康展,大健康展11月13日
- sqlserver的CDC第一次查询的能读取到数据,但后面增删改读取不到,是什么原因
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- Interpretation of SIGMOD '22 hiengine paper
- How to download files using WGet and curl
- 整理混乱的头文件,我用include what you use
- 神经网络物联网应用技术就业前景【欢迎补充】
- 建立自己的网站(15)
- Scala basic tutorial -- 15 -- recursion
猜你喜欢
Li Kou brush question diary /day7/2022.6.29
力扣刷题日记/day2/2022.6.24
自由小兵儿
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
Scala basic tutorial -- 19 -- actor
Mxnet implementation of googlenet (parallel connection network)
正则替换【JS,正则表达式】
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
Build your own website (15)
神经网络物联网应用技术就业前景【欢迎补充】
随机推荐
其他InterSystems %Net工具
【uniapp】uniapp开发app在线预览pdf文件
性能优化之关键渲染路径
Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii
1、 Introduction to C language
【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
repeat_P1002 [NOIP2002 普及组] 过河卒_dp
Li Kou brush question diary /day7/2022.6.29
2022养生展,健康展,北京大健康展,健康产业展11月举办
Cache é JSON uses JSON adapters
An example of multi module collaboration based on NCF
PB的扩展DLL开发(超级篇)(七)
Torchdrug tutorial
2022健康展,北京健博会,中国健康展,大健康展11月13日
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
6.26CF模拟赛E:价格最大化题解
利用策略模式优化if代码【策略模式】
vbs或vbe如何修改图标
Scala basic tutorial -- 12 -- Reading and writing data
[uniapp] uniapp development app online Preview PDF file