using UnityEngine;
public class Example : MonoBehaviour
{
void Start()
{
Vector2[] points = new Vector2[] {
new Vector2(1, 5),
new Vector2(2, 3),
new Vector2(3, 8)
};
// 使用Array.Sort和自定义比较器进行倒序排列
Array.Sort(points, (a, b) => b.y.CompareTo(a.y));
foreach (var point in points)
{
Debug.Log(point);
}
}
}