Essentially the error is telling you there is no natural way to sort a list of GameObjects. How do you tell if which GameObject comes first?
You need to [provide a sort method][1] to GObj.Sort(). The following pseudo code sorts the GameObjects in alphabetical order by name.
....
GObj.Sort(SortMethod(GameObject A, GameObjectB));
....
private int SortMethod (GameObject A, GameObjectB){
if (!A && !B) return 0;
else if (!A) return -1;
else if (!B) return 1;
else return A.name.CompareTo(B.name);
}
[1]: http://msdn.microsoft.com/en-us/library/w56d4y5z(v=vs.110).aspx
↧