Sorting an Array according to variable.

Hello,

I am trying to sort an array of actors according to a variable placed on each actor. However for some reason only the first entry of my array is being sorted, if I remove the ‘Way Point Number’ variable and simply allow the insert node to assign indexes the entire array is copied. Below is a screen shot, any help would be great.

This shows the array not being copied.

This shows the array being copied but not being sorted.

I don’t have UE open in front of me, but before you start inserting items into your sorted array, you can resize the array, use the resize node, and make it the same size as get all actors array result. Then you can set the array element using the set array element node…just remember that the array index starts at zero so depending on how you numbered the way points, you may want to insert at waypoint number-1.

Hi thanks for the reply, I did try using the resize node but then i had the problem of having lots of empty slots. In the end i decided to wire the blueprint slighty differently. But it works good now :slight_smile: thanks for the help anways.