当前位置:网站首页>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();
}
边栏推荐
- Li Kou brush question diary /day4/6.26
- [mathematical modeling of graduate students in Jiangxi Province in 2022] analysis and code implementation of haze removal by nucleation of water vapor supersaturation
- Halcon template matching
- 2022-07-04:以下go语言代码输出什么?A:true;B:false;C:编译错误。 package main import 'fmt' func
- 2022养生展,健康展,北京大健康展,健康产业展11月举办
- 信息学奥赛一本通 1336:【例3-1】找树根和孩子
- 力扣刷题日记/day1/2022.6.23
- 力扣刷题日记/day4/6.26
- 基于unity的愤怒的小鸟设计
- Caché WebSocket
猜你喜欢
How is the entered query SQL statement executed?
Scala基础教程--16--泛型
How is the entered query SQL statement executed?
每日一题(2022-07-02)——最低加油次数
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
Angry bird design based on unity
力扣刷题日记/day3/2022.6.25
字节跳动Dev Better技术沙龙成功举办,携手华泰分享Web研发效能提升经验
力扣刷题日记/day8/7.1
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
随机推荐
整理混乱的头文件,我用include what you use
Interpretation of SIGMOD '22 hiengine paper
一、C语言入门基础
[mathematical basis of machine learning] (I) linear algebra (Part 1 +)
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
工厂从自动化到数字孪生,图扑能干什么?
奥迪AUDI EDI INVOIC发票报文详解
【2022年江西省研究生数学建模】水汽过饱和的核化除霾 思路分析及代码实现
Nature Microbiology | 可感染阿斯加德古菌的六种深海沉积物中的病毒基因组
A method of using tree LSTM reinforcement learning for connection sequence selection
千万不要只学 Oracle、MySQL!
An example of multi module collaboration based on NCF
Scala基础教程--14--隐式转换
How is the entered query SQL statement executed?
PB的扩展DLL开发(超级篇)(七)
Scala basic tutorial -- 17 -- Collection
Cache é JSON uses JSON adapters
ByteDance dev better technology salon was successfully held, and we joined hands with Huatai to share our experience in improving the efficiency of web research and development
Digital "new" operation and maintenance of energy industry
Send and receive IBM WebSphere MQ messages