A relatively common problem. At this time, it is a bit troublesome to write with quick queue.
Example:
class CC { public int Fitness; }
int SortItem(CC _ai1,CC _ai2)
{
if (_ai1.Fitness > _ai2.Fitness) return 1;
else return -1;
}
Call method:
var _list = new List<CC>();
_list.Add(new CC { Fitness = 342 });
_list.Add(new CC { Fitness = 3 });
_list.Add(new CC { Fitness = 3423 });
_list.Sort(SortItem);
foreach (var idx in _list) Debug.Log(idx.Fitness);
Print result:
Its underlying principle is roughly as follows, which plays a role in the bottom line (the performance is definitely not as good as its own optimization)