A Blueprint for clearing object arrays of invalid entries

Recently I’ve been working with arrays of pawns and other actors. I usually required up to date arrays and sometimes found that there would be invalid entries due to actor destruction. I made this BP for validating all the object entries in an array and removing invalid ones. Note: This will change the length of your array if it finds some to remove.

I thought this was some fairly simple solution to something that might be needed in lots of cases.

Hope it helps some of you.

EDIT: I realise that I’ve included another function that doesn’t exist by deafult. It’s a Sort Array Int function. It uses the bubble sort method. You can see it here.

Here is a simple way to do it ( don’t forget to pass the array as reference )