From bea0361e16d5ed681f08464fe3dcad9e9e347c85 Mon Sep 17 00:00:00 2001 From: Ino Date: Fri, 5 Dec 2025 15:25:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=88=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Editor/MyUIUtil.cs | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Assets/Scripts/Editor/MyUIUtil.cs b/Assets/Scripts/Editor/MyUIUtil.cs index 635c576..dc058cc 100644 --- a/Assets/Scripts/Editor/MyUIUtil.cs +++ b/Assets/Scripts/Editor/MyUIUtil.cs @@ -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")