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); });
posted @ 2017-04-19 16:13  带狗狗带  Views(1368)  Comments(0Edit  收藏  举报