0
Pending Review

Sorting by delegate

James A 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

What is the workflow for sorting lists? For example, if you had a list of game objects and wanted to sort them in order of distance from a particular target.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Pending Review

You have me there, I'm not sure how to give you a quick solution or workaround. :/

Sorting a list of integers or strings for example is easy, because the value itself is the sorting order.

Sorting by a member of each item requires the notion of delegates (e.g. "pass me an argument that tells me, provided I give you an item, what on that item I should use to compare and sort").

Delegates are not easy to represent visually in a graph context.

I'll try to think of solutions and let you know if I find any.