Update UnityTool.cs

This commit is contained in:
2024-11-24 17:36:13 +08:00
parent 9543d707f7
commit a7b585a166
+7 -2
View File
@@ -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