How to sort array of Vector3?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Boris007

Sort on an array of Vector3 returns Nil.

:bust_in_silhouette: Reply From: jgodfrey

sort() is a void method, so it doesn’t return anything. Instead, it directly sorts the array it’s called on. So…

your_array.sort()

… will directly sort your_array.

That said, I’m not sure what it’ll do with a an array of Vector3. If it doesn’t do what you want / expect, you may wan to to use sort_custom() instead.