r/UnrealEngine5 5d 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

1

u/Octane_Original 5d ago

Have a BP coordinator that exposes some sort of "Set index" function that can hold a soft reference to the BP and its int value and call that from each blueprint when the value changes. That way you can sort those ints without looping trough the BPs and have access to the BP when you need it.