From b19fb56c8c88cb392ce3fbcad82a3b4a11f4db2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=95=EC=9D=B8?= Date: Fri, 13 Feb 2026 12:23:09 +0900 Subject: [PATCH] =?UTF-8?q?UTKPropertyWindow=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/FixMCPEditorPrefs.cs | 148 +++++++++ Assets/Editor/FixMCPEditorPrefs.cs.meta | 2 + .../Window/UTKPropertyListWindowSample.uxml | 20 ++ .../UTKPropertyListWindowSample.uxml.meta | 10 + .../UIToolkit/UTKStyleGuideSample.Window.cs | 309 ++++++++++++++++++ .../Sample/UIToolkit/UTKStyleGuideSample.cs | 6 +- .../UIToolkit/Window/UTKPropertyListWindow.cs | 10 +- Packages/packages-lock.json | 2 +- 8 files changed, 504 insertions(+), 3 deletions(-) create mode 100644 Assets/Editor/FixMCPEditorPrefs.cs create mode 100644 Assets/Editor/FixMCPEditorPrefs.cs.meta create mode 100644 Assets/Resources/UIToolkit/Sample/Window/UTKPropertyListWindowSample.uxml create mode 100644 Assets/Resources/UIToolkit/Sample/Window/UTKPropertyListWindowSample.uxml.meta diff --git a/Assets/Editor/FixMCPEditorPrefs.cs b/Assets/Editor/FixMCPEditorPrefs.cs new file mode 100644 index 00000000..5b588a9a --- /dev/null +++ b/Assets/Editor/FixMCPEditorPrefs.cs @@ -0,0 +1,148 @@ +#nullable enable +using UnityEditor; +using UnityEngine; + +/// +/// MCP for Unity EditorPrefs 설정 확인 및 수정 도구 +/// +public static class FixMCPEditorPrefs +{ + private const string GitUrlOverrideKey = "MCPForUnity.GitUrlOverride"; + + [MenuItem("Tools/MCP/Fix EditorPrefs Issue")] + public static void FixEditorPrefs() + { + Debug.Log("=== MCP EditorPrefs 확인 시작 ==="); + + // 현재 저장된 값 확인 + string currentValue = EditorPrefs.GetString(GitUrlOverrideKey, ""); + + Debug.Log($"현재 GitUrlOverride 값: '{currentValue}'"); + Debug.Log($"값 길이: {currentValue.Length}"); + + if (!string.IsNullOrEmpty(currentValue)) + { + // 잘못된 문자가 있는지 확인 + char[] invalidChars = System.IO.Path.GetInvalidPathChars(); + bool hasInvalidChars = currentValue.IndexOfAny(invalidChars) >= 0; + + if (hasInvalidChars) + { + Debug.LogWarning($"⚠️ 잘못된 경로 문자가 감지되었습니다!"); + Debug.LogWarning($"문제가 있는 값: '{currentValue}'"); + + // 잘못된 값 제거 + EditorPrefs.DeleteKey(GitUrlOverrideKey); + Debug.Log("✅ 잘못된 EditorPrefs 값을 제거했습니다."); + } + else + { + Debug.Log("경로 문자 검증: 정상"); + + // Path.IsPathRooted() 테스트 + try + { + bool isRooted = System.IO.Path.IsPathRooted(currentValue); + Debug.Log($"IsPathRooted 테스트: {isRooted} (정상)"); + } + catch (System.Exception ex) + { + Debug.LogError($"❌ IsPathRooted 호출 실패: {ex.Message}"); + Debug.LogWarning("잘못된 값을 제거합니다..."); + EditorPrefs.DeleteKey(GitUrlOverrideKey); + Debug.Log("✅ 잘못된 EditorPrefs 값을 제거했습니다."); + } + } + } + else + { + Debug.Log("GitUrlOverride 값이 비어있습니다. (정상)"); + } + + Debug.Log("=== MCP EditorPrefs 확인 완료 ==="); + Debug.Log("Unity 에디터를 재시작하거나 MCP 윈도우를 다시 열어주세요."); + } + + [MenuItem("Tools/MCP/Show All MCP EditorPrefs")] + public static void ShowAllMCPPrefs() + { + Debug.Log("=== 모든 MCP EditorPrefs 값 ==="); + + string[] keys = new[] + { + "MCPForUnity.GitUrlOverride", + "MCPForUnity.UseHttpTransport", + "MCPForUnity.HttpTransportScope", + "MCPForUnity.UvxPath", + "MCPForUnity.ClaudeCliPath", + "MCPForUnity.HttpUrl", + "MCPForUnity.HttpRemoteUrl", + }; + + foreach (string key in keys) + { + if (EditorPrefs.HasKey(key)) + { + string value = EditorPrefs.GetString(key, ""); + Debug.Log($"{key}: '{value}'"); + } + else + { + Debug.Log($"{key}: (설정되지 않음)"); + } + } + } + + [MenuItem("Tools/MCP/Clear All MCP EditorPrefs")] + public static void ClearAllMCPPrefs() + { + bool confirm = EditorUtility.DisplayDialog( + "MCP EditorPrefs 초기화", + "모든 MCP for Unity 설정을 초기화하시겠습니까?\n이 작업은 되돌릴 수 없습니다.", + "초기화", + "취소" + ); + + if (!confirm) + { + Debug.Log("취소되었습니다."); + return; + } + + Debug.Log("=== MCP EditorPrefs 초기화 시작 ==="); + + string[] keys = new[] + { + "MCPForUnity.GitUrlOverride", + "MCPForUnity.UseHttpTransport", + "MCPForUnity.HttpTransportScope", + "MCPForUnity.LastLocalHttpServerPid", + "MCPForUnity.LastLocalHttpServerPort", + "MCPForUnity.LastLocalHttpServerStartedUtc", + "MCPForUnity.LastLocalHttpServerPidArgsHash", + "MCPForUnity.LastLocalHttpServerPidFilePath", + "MCPForUnity.LastLocalHttpServerInstanceToken", + "MCPForUnity.UvxPath", + "MCPForUnity.ClaudeCliPath", + "MCPForUnity.HttpUrl", + "MCPForUnity.HttpRemoteUrl", + "MCPForUnity.DebugLogs", + "MCPForUnity.ValidationLevel", + "MCPForUnity.UnitySocketPort", + "MCPForUnity.ResumeHttpAfterReload", + "MCPForUnity.ResumeStdioAfterReload", + }; + + foreach (string key in keys) + { + if (EditorPrefs.HasKey(key)) + { + EditorPrefs.DeleteKey(key); + Debug.Log($"✅ 삭제: {key}"); + } + } + + Debug.Log("=== MCP EditorPrefs 초기화 완료 ==="); + Debug.Log("Unity 에디터를 재시작해주세요."); + } +} diff --git a/Assets/Editor/FixMCPEditorPrefs.cs.meta b/Assets/Editor/FixMCPEditorPrefs.cs.meta new file mode 100644 index 00000000..31053924 --- /dev/null +++ b/Assets/Editor/FixMCPEditorPrefs.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 955b75403593bb74fbf0ba110a3e1b83 \ No newline at end of file diff --git a/Assets/Resources/UIToolkit/Sample/Window/UTKPropertyListWindowSample.uxml b/Assets/Resources/UIToolkit/Sample/Window/UTKPropertyListWindowSample.uxml new file mode 100644 index 00000000..31b66433 --- /dev/null +++ b/Assets/Resources/UIToolkit/Sample/Window/UTKPropertyListWindowSample.uxml @@ -0,0 +1,20 @@ + + +