How do I delete an actor object from my scene?

I’m very new to UE5 and I’m using blueprints. I have a main blueprint that has a collider that when my character walks through it, it will spawn another random piece from an array. Now I also have another array that adds those spawned pieces to it. Once that array reaches a certain length it grabs the first actor in the array. How Do i destroy that first actor? The destroy node wont let me connect selected actor. The actors are class references which I’m sure is my problem but I don’t know how to fix it.

Sorry if this is a stupid question. I’ve tried looking around the internet for hours now and can not find an answer.

Can you post a screenshot so we can see what you’re doing?

Sorry for the late reply. I got busy. I’ve got two images here.

This one is in my third person character. I’m creating a an array of the spawned pieces (which you’ll see in the next image) and am checking the length. If the length is greater than 2 then I’m taking the first item of the array and “Trying” to destroy it from the scene.

Here in the map piece BP you can see that I’m generating the pieces once my character passes through a collider and then I’m adding the generated piece to the spawned list. I at first tried running it all through the map piece BP, but its just the main actor. It’s used to spawn a bunch of different children. So of course that didn’t work.

I’m sure the solution is something simple that I just don’t know yet. Thank you for the assistance in advance.

1 Like

Sorry. The first image uploaded shows something I just tried and forgot to remove. I know that will destroy my character from the game. So that isnt in the blueprint now.

This helps, greatly!

What is the class of your array object(s)?

The reason I ask is because it appears you are trying to destroy the CLASS of the objects instead of the objects themselves.

Hi!

I actually just got it working. I just discovered the “Get Actor Of Class” node. And used it to get the first index in the array, and then destroyed that and then removed it from the index. I’ve been messing with this for so long haha. Your question is what made me realize what I was doing wrong with the classes.

Here’s an image of my fix.

1 Like