当前位置:网站首页>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();
}
边栏推荐
- Other InterSystems%net tools
- DeFi生态NFT流动性挖矿系统开发搭建
- Scala basic tutorial -- 12 -- Reading and writing data
- Li Kou brush question diary /day7/2022.6.29
- From automation to digital twins, what can Tupo do?
- 6.26CF模拟赛E:价格最大化题解
- Microservice architecture debate between radical technologists vs Project conservatives
- Interpretation of SIGMOD '22 hiengine paper
- C语言打印练习
- Li Kou brush question diary /day1/2022.6.23
猜你喜欢
An example of multi module collaboration based on NCF
读写关闭的channel是啥后果?
Scala基础教程--18--集合(二)
How is the entered query SQL statement executed?
基于unity的愤怒的小鸟设计
redis分布式锁的8大坑总结梳理
正则替换【JS,正则表达式】
Halcon模板匹配
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
Scala basic tutorial -- 15 -- recursion
随机推荐
使用FTP
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
Scala basic tutorial -- 17 -- Collection
Li Kou brush question diary /day4/6.26
Scala basic tutorial -- 20 -- akka
信息学奥赛一本通 1336:【例3-1】找树根和孩子
How to open an account is safe,
李迟2022年6月工作生活总结
Go微服务(二)——Protobuf详细入门
Torchdrug tutorial
一种将Tree-LSTM的强化学习用于连接顺序选择的方法
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
工厂从自动化到数字孪生,图扑能干什么?
[opencv introduction to mastery 9] opencv video capture, image and video conversion
基于NCF的多模块协同实例
力扣刷題日記/day6/6.28
Li Kou brush question diary /day3/2022.6.25
力扣刷题日记/day6/6.28
[cloud voice suggestion collection] cloud store renewal and upgrading: provide effective suggestions, win a large number of code beans, Huawei AI speaker 2!
IBM WebSphere MQ检索邮件