从资源子文件夹获取文件名 [英] Get file names from Resources sub folder

查看:96
本文介绍了从资源子文件夹获取文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Resources文件夹中,我有一个图像子文件夹,我想从该文件夹中获取这些图像的所有文件名.

In my Resources folder I have a subfolder for images, I would like to get all the file names of those images from within that folder.

尝试了几种Resources.loadAll方法,后来却获得了.name但没有成功

tried several Resources.loadAll methods to afterwards get the .name but without success

实现我在这里想要做的事是正确的做法吗?

was is the right practice to achieve what I'm trying to do here ?

推荐答案

嗯...为什么不尝试呢?

Hmm... why not try this.

using System.IO;

Const String path = ""; /file path

private void GetFiles()
{
     string [] files = Directory.GetFiles (path, "*.*");
     foreach (string sourceFile in files)
     {
          string fileName = Path.GetFileName (sourceFile);
          Debug.Log("fileName");
     }
}

这篇关于从资源子文件夹获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆