When i use " GetComponentsInChildren < Transform > ();" it also adds parent's transform to that array, is this a bug or intended behaviour? Also how can i only get and set transform in children and not parent?
http://docs.unity3d.com/ScriptReference/Component.GetComponentsInChildren.html Returns all components of Type type in the GameObject or any of its children Intended. You could try converting it to a list, and removing the one you don't want Code (CSharp): T[] array = GetComponentInChildren<T>(); List<T> list = new List<T>(array); list.remove(GetComponent<T>()); //optionally: array = list.ToArray();
Code (csharp): Transform[] children = GetComponentsInChildren<Transform>().Where(t => t != transform).ToArray();