unity 2d游戏 按y坐标排序子对象
List<Transform> objs = new List<Transform>(); for (int i = 0; i < transform.childCount; i++) { objs.Add(transform.GetChild(i)); } objs.Sort(delegate(Transform x, Transform y) { return x.position.y.CompareTo(y.position.y); });
List<Transform> objs = new List<Transform>(); for (int i = 0; i < transform.childCount; i++) { objs.Add(transform.GetChild(i)); } objs.Sort(delegate(Transform x, Transform y) { return x.position.y.CompareTo(y.position.y); });