您的位置:首页 > 移动开发 > Unity3D

unity 浏览文件夹下某一格式文件进行保存

2018-02-02 11:22 357 查看
这个是简单的进行浏览文件夹里面的文件并且进行保存,我这是以.jpg为例子,错误地方,纠正,指教
using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class RecordID : MonoBehaviour
{

void Start()
{

string fullPath = Application.dataPath + "/你的文件夹名字/";
List<string> nameList = new List<string>();
//获取指定路径下面的所有资源文件
if (Directory.Exists(fullPath))
{
DirectoryInfo direction = new DirectoryInfo(fullPath);
FileInfo[] files = direction.GetFiles("*.jpg", SearchOption.AllDirectories);//jpg为例

for (int i = 0; i < files.Length; i++)
{
nameList.Add(files[i].Name);//进行保存
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐