1
This commit is contained in:
parent
1f53bf8be4
commit
8a0a2b1a00
@ -44,17 +44,14 @@ namespace UnityEngine.UI
|
||||
[ContextMenu("Bind HotKeys")]
|
||||
private void CollectUXHotkeys()
|
||||
{
|
||||
// 更稳健的查找:先拿所有 MonoBehaviour,再 OfType 接口
|
||||
var found = gameObject
|
||||
.GetComponentsInChildren<MonoBehaviour>(true)
|
||||
.OfType<IHotkeyTrigger>()
|
||||
.Where(t => t.HotkeyAction != null) // 保留原来的筛选条件(如果 HotkeyAction 存在)
|
||||
.Where(t => t.HotkeyAction != null)
|
||||
.Select(t => t as Component)
|
||||
.ToArray();
|
||||
|
||||
hotButtons = found;
|
||||
|
||||
Debug.Log($"[HotkeyBindComponent] 已找到 {hotButtons.Length} 个 UXHotkey 组件并绑定。");
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user