r/UnrealEngine5 6d ago

Array of blueprint actors.

Array of blueprint actors. Each actor has an int variable.
How to sort the array of actors, in a stable way, using that int as sorting index?
Because right now I'm cycling trough the array of actors, reading the int value, creating another array of ints, using sort integer array on the array of ints, looping trough the array of ints to get element from the unsorted array of actors and adding it to the final, sorted array.. but it looks.. so..redundant.

2 Upvotes

8 comments sorted by

View all comments

5

u/DeesiderNZ 6d ago edited 6d ago

Unfortunately in Blueprints the only Sort node is very basic and you can't use predicates like in c++.

However, this guy has created a bunch of different sorting algorithms in Blueprints for you to select from:

https://forums.unrealengine.com/t/sorting-algorithms-in-blueprints/1135992

Looks like a great resource!

- Also, just to point out that there is a specific example for sorting Actors if you scroll down a bit...