Sort actors in an array by an internal variable?

Maybe I’m going about this wrong, but here’s my scenario.

I have 8 pawns in the game. Each of them has a float variable called RaceProgress which is their percentage along a spline. I want to get all of the actors of class “MyPawn” and then sort them in ascending order by their RaceProgress. without losing which actor is which. I can’t for the life of my figure out how to do this while also retaining the specific actors so I can then assign them a race position value.
If I just get the Race Progress of each and then add them to an array, I can use the MaxOfFloat node to figure out which one is the highest, but then I only have the floats and don’t know who their owning actor was.

You might be able to use something like this:

349581-codescreenshot.png

  • Here it is…!
  • Map Pawns to RaceProgress and then Sort Race Progresses
  • And then get Pawn from Map with RaceProgress and Set Position based on Sorted Race Progresses Index

349577-screenshot-460.png

Would this work if two pawns have the same race progress?
And also, a quick thought I just had, would an array of a custom struct work well here?