Question by
jayanthvoyager · Jan 11, 2016 at 03:47 PM ·
lists
How to do this step without using ConvertAll ??
List components = new List(SplineRoot.GetComponentsInChildren(typeof(Transform)));
List transforms = components.ConvertAll(c => (Transform)c);
How to do this step without using ConvertAll ??
Comment
Answer by Euri · Jun 11, 2017 at 02:58 AM
Transform[] GetTransforms()
{
if (SplineRoot != null)
{
/*List<Component> components = new List<Component>(SplineRoot.GetComponentsInChildren(typeof(Transform)));
List<Transform> transforms = components.ConvertAll(c => (Transform)c);*/
List<Transform> transforms = new List<Transform>(SplineRoot.GetComponentsInChildren<Transform>());
transforms.Remove(SplineRoot.transform);
/*transforms.Sort(delegate(Transform a, Transform b)
{
return a.name.CompareTo(b.name);
});*/
return transforms.ToArray();
}
return null;
}