This commit is contained in:
in0finite 2022-01-29 01:49:01 +01:00
parent 3813d5b0f4
commit 0e5399a896

View file

@ -286,14 +286,14 @@ namespace SanAndreasUnity.Utilities
}
}
public static List<Transform> GetFirstLevelChildrenPreallocated(this Transform tr)
public static Transform[] GetFirstLevelChildrenPreallocated(this Transform tr)
{
var list = new List<Transform>(tr.childCount);
var array = new Transform[tr.childCount];
for (int i = 0; i < tr.childCount; i++)
{
list.Add(tr.GetChild(i));
array[i] = tr.GetChild(i);
}
return list;
return array;
}
public static IEnumerable<T> GetFirstLevelChildrenComponents<T>(this GameObject go) where T : Component