private Dictionary<int,T> LoadConfig<T>(string fileName) where T : class,new()
{
Dictionary<int, T> dic = new Dictionary<int, T>();
TextAsset bossCfgInfo = Resources.Load<TextAsset>("Config/" + fileName);
//新建xml文档对象
XmlDocument document = new XmlDocument();
//把字符串加载到对象中
document.LoadXml(bossCfgInfo.text);
//获取根节点
XmlNode rootNode = document.Selec
Unity3D-动态读取配置文件,加载游戏对象
最新推荐文章于 2024-07-04 10:26:54 发布
本文介绍了如何在Unity3D中动态地读取配置文件,并根据文件内容加载相应游戏对象。关键在于配置文件需映射到一个公有类,类的字段与配置文件属性一一对应,确保变量名相同。
摘要由CSDN通过智能技术生成