Help: Destroying Spawned #d Widget BP

Hi

I have an array where I run a for loop to generate 3D widgets in game.

They spawn great.

Tried this to delete them, but only 3 destroy. Also tried a manual array index. No luck

Any ideas?

  • Edit, I know false and true are connected, did it as a double check for errors.

How many elements are in your stock array?

5

Regards

Well, it is trying to destroy the one at that specific index, but there will only be a 3d widget at that index for the first 3. It’s running get actors of class each , and making a new array, numbered 0 to whatever.

So what I think is happening, is that after the one at 0 is destroyed, the indices 0,1,2,3 remain, then you destroy 1, and 0,1,2 remain, then you destroy 2, and it’s 0,1 left. So the last two are never destroyed. When you spawn those 3d widgets, add them to an array, so you will be able to refernece them without using get actors of class.

Also, you don’t need to cast before destroying them

I think you have hit on it. Made it reference 0 and 4 were destroyed.

Just got to get rid on the last one now.

A little head scratching.

How are you spawning them?

Got it

Thanks again

*edit: it works, but shortened it too much. need to put some nodes back in or I get this error.