This action has since been created, but I am having a small trouble with it.
Array List Sort Game Object By Distance
https://darkhitori.snipt.net/arraysortgameobjectbydistance/When sorting the game objects in the list, it does not seem to sort the one in index 0. Also the ones after that are ALWAYS sorted correctly.
Not sure it's a bug, because it does NOT happen EVERY time. I can't explain why it leaves the one object that is surely further away and is in index 0, but sometimes it sorts it correctly.
What I am doing:
I have a bunch of objects in a line in the scene and they are also named in alphabetical order. (A closest, B farther, etc.)
(This also helps in debugging, as I can instantly see if the sorting happened correctly or not.)
I randomly select 10 objects and place them into the array list. At this point it has 10 game objects in it in random order.
Then I use the "Array List Sort Game Object By Distance" action and observe that:
1. sometimes the one in index 0 is left there and all after that are sorted nicely,
2. other times it is all ok, (all sorted nicely in order),
3. and even rarely another object that is not the closest gets put into index 0.
The one thing in common in the results is that in all cases index 1-9 are always sorted properly.
Any idea?
Is there an error in the script that could cause such erratic behavior?
Thanks in advance,
szomaza