From a7b585a1664df6449932dffb31e4170cf07faf82 Mon Sep 17 00:00:00 2001 From: Ding Yuntian <1491671119@qq.com> Date: Sun, 24 Nov 2024 17:36:13 +0800 Subject: [PATCH] Update UnityTool.cs --- Assets/Scripts/Framework/Core/UnityTool.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Framework/Core/UnityTool.cs b/Assets/Scripts/Framework/Core/UnityTool.cs index d3c8b2da3..2947e7431 100644 --- a/Assets/Scripts/Framework/Core/UnityTool.cs +++ b/Assets/Scripts/Framework/Core/UnityTool.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using AibisDream; using UnityEngine; namespace Framework.Core @@ -120,13 +121,17 @@ namespace Framework.Core { if (dic.TryGetValue(type, out var components)) return components; + if (type.IsArray) + { + type = type.GetElementType(); + } + var selfComponent = mono.GetComponent(type); var childrenComponents = mono.GetComponentsInChildren(type, true); components = selfComponent != null ? new[] { selfComponent }.Concat(childrenComponents).ToArray() : childrenComponents; - - + if (components == null || components.Length == 0) { #if UNITY_EDITOR