Sorting an array based of a struct value
I saw a post about it and try to implement in my game but it didn't work. What am I doing wrong?
asked Jul 18 '18 at 11:10 AM in Blueprint Scripting
I figured it out. After the 'while completed', I clear the first array, then set the new array to the first array.
answered Jul 26 '18 at 05:34 PM
Hi w0hoho, I've attached a working example of reordering a struct based on content values.
It's not necessarily the best way of doing it. The last node used needs to be a number appropriate to the scale of the values you're using. If your max value is 1000 then this needs to be something higher than that. (it's only used so that this array element is never chosen by "Min int of array")
Hope this helps
answered Jul 19 '18 at 10:20 AM
It is almost always better to perform array manipulations in C++ rather than in Blueprints both in terms of performance and convenience so you might want to try sorting in C++.
As for your problem with scrollbox, you would need to retriveve the values of the cards from it and store them in the array, then sort the array as you do, clear the scrollbox and fill it with sorted values again.
Hope it helps
answered Jul 20 '18 at 10:19 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here