【工具】刷新资源路径工具不再自动重命名

gaoxin 2020-11-13 11:30:50 +08:00
parent 26cbfccf57
commit 31378d1a76
1 changed files with 16 additions and 16 deletions

View File

@ -264,22 +264,22 @@ namespace GameEditor
if (resPaths.ContainsKey (fileName)) { if (resPaths.ContainsKey (fileName)) {
var info = resPaths[fileName]; var info = resPaths[fileName];
string oldPath = string.Format("{0}/{1}{2}", dirPaths[info.resPathIndex], info.resName, info.extension); string oldPath = string.Format("{0}/{1}{2}", dirPaths[info.resPathIndex], info.resName, info.extension);
Debug.LogErrorFormat("资源名重复:{0}=>{1}", path, oldPath); Debug.LogErrorFormat("资源名重复:{0}\n原有资源{2}\n重复资源:{1}", info.resName, path, oldPath);
string exName = Path.GetExtension(path).Replace(".", ""); //string exName = Path.GetExtension(path).Replace(".", "");
if (!string.IsNullOrEmpty(exName)) //给资源文件加后缀名规避重复 //if (!string.IsNullOrEmpty(exName)) //给资源文件加后缀名规避重复
{ //{
if (exName != "prefab")//避免给prefab文件更名 // if (exName != "prefab")//避免给prefab文件更名
{ // {
string newPath = AssetDatabase.RenameAsset(path, Path.GetFileNameWithoutExtension(path) + "_" + exName); // string newPath = AssetDatabase.RenameAsset(path, Path.GetFileNameWithoutExtension(path) + "_" + exName);
Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", path); // Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", path);
} // }
else // else
{ // {
string newPath = AssetDatabase.RenameAsset(oldPath, Path.GetFileNameWithoutExtension(oldPath) // string newPath = AssetDatabase.RenameAsset(oldPath, Path.GetFileNameWithoutExtension(oldPath)
+ "_" + Path.GetExtension(oldPath).Replace(".", "")); // + "_" + Path.GetExtension(oldPath).Replace(".", ""));
Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", oldPath); // Debug.LogErrorFormat("资源名已修正:{0} 请再次刷新文件路径", oldPath);
} // }
} //}
} }
else else
{ {