Help sorting array of structs
I'm trying to make a function to sort an array of structures by one of its members value (a float), from lowest to highest. This is what I have so far:
I thought this would work fine, but it doesn't, and I'm unable to figure out why... Instead of returning the sorted array, the function just returns an array with the same size of the input array, but with the same item -the one with lowest value- repeated.
What am I missing?
Thank you very much in advance! :)
asked Mar 06 '17 at 08:21 AM in Blueprint Scripting
This should fix it. Every time you have a node connected to the MinOfArray node, it is calling it again, and so getting a different value after the min has been removed. If you store the first value it gets each loop, you will avoid this problem:
answered Mar 06 '17 at 10:54 AM
It's also worth mentioning that Rama's Victory Plugin has a Sort node for arrays, and an option to sort by structure or object field. Works fine for me.
answered Mar 21 '18 at 05:05 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here