I’m posting this as I research incase someone has done this before cause I’ve been trying all morning to get this right to no success and feel its a tough nut to crack without good string parsing.
I have 10 arrow components in a blueprint named Tube1, Tube2, … , Tube 10.
I use GetComponentsByClass(ArrowComponent) and put them in an array. They need to be in order and I then need to get their vectors (relativeLocation) and create an array of those locations that match the 1,2,3, etc… 10… setup so Location[0] is == to ArrowCompArr[0] etc.
Of course if they arnt ordered properly, which they never are they dont order properly. Im using locations 1,1,1 2,2,2 3,3,3 etc. to debug.
Heres what I’ve played with most recently, trying to sort 3 ways.
Does anyone have any tips for getting this setup right?
Sorry about the mess, tried to fit it on one screen. I have the vector array variable, and th elocal variables, and you can see the arrow components intentionally in disorder.
Yes what a mess!
Have you tried using “Set Array Elem”?
Plug the index from your loop into the index of both nodes/array and maybe use “Size to Fit” in case you have not set the array size manually.
In case its still not working, i would like to see what is happening and maybe your array setup.
Finally got it, it took 3 arrays to get the list into one final array of relLocs of these components but now its prototyped and no code smell and future proof.
Set array elem helped alittle, thanks. It was displayname vs object name that got me. Object name made it much easier. Just trim Tube from tube1,2,3,4 etc and sort the remaining numbers.
Array sorting and string parsing doesnt lend itself well to blueprints.