How to sort list with Vector3 variables?

Make a level editor - you need all the objects to drive into the array list and sort the array so that 1 was the vector with the lowest value, and latest with the greatest.
June 3rd 19 at 19:07
1 answer
June 3rd 19 at 19:09
Solution
Implement the interface IComparable<t></t> if you own a class, and then the usual list.Sort() will sort using your own comparison. Or create a helper class with IComparer<t></t> if you need only one comparison method, and point it to the Sort method.
At worst describe directly in place:
parts.Sort(delegate(Part x, Part y)
{
 if (x.PartName == null && y.PartName == null) return 0;
 else if (x.PartName == null) return -1;
 else if (y.PartName == null) return 1;
 else return x.PartName.CompareTo(y.PartName);
 });

https://msdn.microsoft.com/ru-ru/library/b0zbh7b6(...

Find more questions by tags C#Development of gamesUnity Game Engine