How to use ForEachLoop to remove items from array?
Hello! For example of problem I created a simple Blueprint - I'm adding some elements to empty Cell_Array and then try to remove them all. But 1/2 of elements are still in Cell_Array after all. How to remove elements from Cell_Array while iteration using only blueprint scripting? What is the usual solution? Thanks!
asked Aug 27 '15 at 02:49 PM in Blueprint Scripting
The problem is that as you remove items from the array, it shrinks some elements passed below your current index. You can create a ForLoop to go in reverse manually.
Hope that Helps =)
answered Aug 27 '15 at 03:00 PM
Copy the array, now you have 2 identical arrays. Do foreach loop on either array and remove the coresponding index from the another array. Should work.
answered Aug 27 '15 at 03:25 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here