[MenuItem("Tools/ChangePlat/ANDROID_DEFAULE")]
static void ChangePlatANDROID_DEFAULE()
{
ChangePlat("ANDROID_DEFAULE");
}
static void ChangePlat(string platName)
{
FileStream fs = File.OpenRead(Application.dataPath + "/Scripts/Model/Upgrade/UpgradeConfig.cs");
StreamReader sr = new StreamReader(fs);
StringBuilder sb = new StringBuilder();
string content = "";
while (sr.Peek() > 0)
{
content = sr.ReadLine();
if (content.Contains("PlatForm"))
{
int index = content.IndexOf("=");
string newS = content.Substring(0, index);
content = newS + "= \"" + platName + "\";";
}
sb.Append(content + "\n");
}
fs.Close();
sr.Close();
StreamWriter sw = new StreamWriter(Application.dataPath + "/Scripts/Model/Upgrade/UpgradeConfig.cs");
sw.Write(sb.ToString());
sw.Close();
AssetDatabase.Refresh();
}
}
编辑器修改代码或文本配置表
最新推荐文章于 2023-09-11 14:41:02 发布