Update UnityTool.cs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user