Archived
已修复递归寻找组件时只寻找所有第一个对象的问题
This commit is contained in:
@@ -141,12 +141,22 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
{
|
||||
int newRecursion = recursion - 1;
|
||||
|
||||
foreach(var item in trans.GetChildren())
|
||||
//foreach(var item in trans.GetChildren())
|
||||
//{
|
||||
// var comp = item.GetComponent<T>();
|
||||
// if(comp == null && newRecursion > 0)
|
||||
// comp = item.GetComponentInRecursionChildren<T>(newRecursion);
|
||||
// yield return comp;
|
||||
//}
|
||||
|
||||
T[] comps;
|
||||
foreach(var item in trans.GetChildrenRecursion(newRecursion))
|
||||
{
|
||||
var comp = item.GetComponent<T>();
|
||||
if(comp == null && newRecursion > 0)
|
||||
comp = item.GetComponentInRecursionChildren<T>(newRecursion);
|
||||
yield return comp;
|
||||
comps = item.GetComponents<T>();
|
||||
if(comps != null
|
||||
&& comps.Length > 0)
|
||||
foreach (var comp in comps)
|
||||
yield return comp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user