이름 변경툴
This commit is contained in:
parent
d7979462f3
commit
bea0361e16
|
|
@ -1,3 +1,4 @@
|
|||
using System.IO;
|
||||
using TMPro;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
|
@ -5,6 +6,48 @@ using UnityEngine.UI;
|
|||
|
||||
public static class MyUIUtil
|
||||
{
|
||||
[MenuItem("Tools/Safe Rename Files (Space → Underscore)")]
|
||||
public static void RenameFilesInSelectedFolder()
|
||||
{
|
||||
Object obj = Selection.activeObject;
|
||||
if (obj == null)
|
||||
{
|
||||
Debug.LogError("폴더를 선택하세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
string folderPath = AssetDatabase.GetAssetPath(obj);
|
||||
|
||||
if (!Directory.Exists(folderPath))
|
||||
{
|
||||
Debug.LogError("폴더만 선택 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] guids = AssetDatabase.FindAssets("", new[] { folderPath });
|
||||
|
||||
foreach (var guid in guids)
|
||||
{
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
|
||||
if (assetPath.EndsWith(".meta"))
|
||||
continue;
|
||||
|
||||
string name = Path.GetFileName(assetPath);
|
||||
if (!name.Contains(" "))
|
||||
continue;
|
||||
|
||||
string newName = name.Replace(" ", "_");
|
||||
|
||||
AssetDatabase.RenameAsset(assetPath, Path.GetFileNameWithoutExtension(newName));
|
||||
Debug.Log($"변경: {name} → {newName}");
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
Debug.Log("완료!");
|
||||
}
|
||||
|
||||
static string path_whitebg = "Assets/ResWork/UI_Image/Common/whitebg.png";
|
||||
|
||||
static void SetLayerRecursively(GameObject obj, string newLayer = "UI")
|
||||
|
|
|
|||
Loading…
Reference in New Issue