메뉴, 세부 메뉴 활성화/비활성화 기능 개발 및 검색 레이아웃 구성

This commit is contained in:
정영민
2025-09-11 17:05:50 +09:00
parent ae9293ba52
commit 91fe3063dd
149 changed files with 16613 additions and 1114 deletions

View File

@@ -0,0 +1,35 @@
using System.Collections.Generic;
using UnityEngine;
public static class ComponentFinderExtensions
{
/// <summary>
/// 트랜스폼 기준으로 자식들의 컴포넌트를 이름(key)으로 매핑
/// </summary>
public static Dictionary<string, T> FindComponentDictionary<T>(this Transform root, bool includeInactive = true) where T : Component
{
var dict = new Dictionary<string, T>();
var components = root.GetComponentsInChildren<T>(includeInactive);
foreach (var comp in components)
{
if (string.IsNullOrEmpty(comp.name))
continue;
if (!dict.ContainsKey(comp.name))
dict[comp.name] = comp;
}
return dict;
}
/// <summary>
/// Dictionary에서 key로 안전하게 가져오기
/// </summary>
public static T GetOrNull<T>(this Dictionary<string, T> dict, string name)
where T : UnityEngine.Object
{
dict.TryGetValue(name, out var value);
return value;
}
}