unity,我想字典保存成为csv 我实在不在怎么保存了,改了很多都不行 itemlist 这个是我的字典
public Dictionary<int, Item> itemlist = new Dictionary<int, Item>(); 这是字典
public class Item
{
public int itemid;
public int itemtype;
public string itemname;
public string itemimage;
public string item3dname;
[TextArea]
public string iteminfo;
}
//下面就是想把这个字典保存成为csv 但是实在不知道咋搞了
private void saveitem() //写入数据
{
string path = Application.dataPath + "/Item2.csv";
if (File.Exists(path))
{
Debug.Log("存在文件");
for (int i = 0; i < itemlist.Count; i++)
{
写到这不会了。。。。不好意思 请求帮忙
}
}
}
保存csv 或者text是下面这样格式
0,2,sword,gloves,sword1,niubi1
1,2,sword1,sword,sword2,niubi1
用StreamWriter