Erdrik
(Erdrik)
1
I have a TArray of FOverlapResults.
I have a for loop:
for (size_t i = 0; i < ParseList.Num(); i++)
For testing the only line in the for loop is:
ParseList.RemoveAt(i);
This should remove all elements in the TArray, but it does not.
Is there a method for removing specific index elements of a TArray that Im missing?
Is it because your Array.Num changes over time because you remove elements ?
What if you try
while(ParseList.Num() >0) ParseList.RemoveAt(0);
or better
ParseList.Empty();
Erdrik
(Erdrik)
3
Empty() wouldn’t work because I intend to do individual checks for each element, I was just testing at this point.
But your While suggestion helped.
I had completely forgotten to account for re-sizing.
Thanks for your help.
EDIT:
Specifically, a reverse for loop solved the issue:
for (size_t i = ParseList.Num(); i --> 0;)