Unity在Webgl文件夹下处理配置文件的读取问题
发布时间
阅读量:
阅读量
这是一种在PC运行过程中用于访问文件的方式,只需判断文件是否存在并进行加载操作即可。
[Serializable]
public class SanguConfig : BaseConfig
{
public readonly string FileName = Application.dataPath + "/SanguConfig.json";
public SanguConfig()
{
var item = new IdleSanguConfig().CommandsMap;
}
public override IEnumerator DoTheDeserialize()
{
if (System.IO.File.Exists(FileName))
{
Debug.Log("hhh");
string st = System.IO.File.ReadAllText(FileName);
var ds = JsonConvert.DeserializeObject<SanguConfig>(st); // 这个位置会反复调用
全部评论 (0)
还没有任何评论哟~
