When trying to sort an array of GameObjects with Array.Sort I get this:
InvalidOperationException: No IComparable or IComparable interface found.
System.Array.compare[Object] (System.Object value1, System.Object value2, IComparer`1 comparer) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System/Array.cs:1755)
System.Array.qsort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 low0, Int32 high0, IComparer`1 comparer) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System/Array.cs:1721)
System.Array.Sort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 index, Int32 length, IComparer`1 comparer) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System/Array.cs:1674)
Rethrow as InvalidOperationException: The comparer threw an exception.
System.Array.Sort[Object,Object] (System.Object[] keys, System.Object[] items, Int32 index,
Int32 length, IComparer`1 comparer) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System/Array.cs:1677)
System.Array.Sort[Object] (System.Object[] array, Int32 index, Int32 length) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System/Array.cs:1608)
System.Collections.ArrayList.Sort () (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Collections/ArrayList.cs:3185)
UnityScript.Lang.Array.Sort ()
EnemyMoveScript.Start () (at Assets/Scripts/EnemyMoveScript.js:11)
↧