一,放置配置文件位置一般放在 StreamingAssets下面
我的TowManager.TxT文件里面写的是
[Tow_Crystal]
#attack=10
#attackDistance=15
#attackInterval=1.5
#weaponName=Test
[Tow_Gatling]
#attack=15
#attackDistance=10
#attackInterval=4
#weaponName=Test
[Tow_Cannon]
#attack=20
#attackDistance=8
#attackInterval=1
#weaponName=Test
具体代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class Config : MonoBehaviour
{
//把towDic字典中的内容读取到项目中
// 主键 子键 子值
public static Dictionary<string, Dictionary<string, string>> towDic =
new Dictionary<string, Dictionary<string, string>&