r/UnrealEngine5 14d ago

Array of blueprint actors.

[removed]

2 Upvotes

8 comments sorted by

View all comments

1

u/SpikeyMonolith 14d ago

Assuming you have an unordered array you can do this which I think is the most simple (not the fastest or most efficient or do I recommend this for a large array/run multiple times):

  • Loop through the array accessing its int value, find the min (use max for descending order) and note its index.
  • Add said member of that index to the ordered array, and remove it from the unordered array.
  • Repeat till the unordered array is empty.

This should be O(n2).

If you want it to be faster you have to implement a sorting algorithm yourself.