Hi, I’m using a ‘‘selection’’ map (int / static mesh component ref) to delete the chips from my stack corresponding to that selection. The first time I run the operation it goes perfectly, the second time sometimes can cause issues and skips removing parts of my keys. I’m also running a for each loop on the remaining values of my stack so it sorts the keys starting from 1 in order to avoid unmatching key issues with my selection but still doesnt work. A reverse for each loop doesnt seem to be working to remove keys correctly either, so I have no ideas how I can do this. Thanks in advance to anyone who’s willing to help
why are you doing +1 on the map key?
Hi Auran, I should have mentioned, Its because the map variable ‘‘Chip component in stack’’ key starts at 1 and the chips selection at 0
i feel like that may still cause a desync somewhere, for example you +1 at the start and then again on the second loop. it would be better to keep the logic on the same index and say display it to the user as +1 in the UI.
but its hard to follow from the screenshot alone. you can breakpoint at every step and see where it breaks.
the other thing i’d recommend is use local variables for reordering and set the final sorted value back to the original Map, this ensures you dont somehow alter the map mid sort.
So I ended up getting rid of maps and I used only arrays for my static mesh components so it fixed the issue and made the code simpler and handled the sorting easier. Thanks you
