I am trying to destroy the previous actor out of an array I make from actors that spawn every time I press a button,
Ok, So I press tab, I spawn an actor and put it into an array. First one has an index of 0. I have the foreachloop make sure the index is above 0 so it doesnt destroy anthing the first time.
I press tab again, now the for each loop is reading both of the items I have in the array, the first one is index 0, the second is index 1, greater than zero so I take that number, I subtract 1 from it to get an int of 0, I re-get my array and tell it to destroy the actor with an index of 0. My plan would be I press the spawn button again and the next array now only has 2 items in it, one with an index of 1 and one with 2, i subtract one from the 2 to get an int of 1 and have the get function tell destroy actor to now destroy the actor with an index of 1…
The problem is that when I press the spawn button the second time it is telling me it can’t access it because of the pending kill. I have tried using destroy actor when finished with the same problem.