How to delete spawning objects in the scene?

In order to delete the object/actor, you’ll use the node Destroy Actor.

You can look at this previous example of mine to track the actor you’re hovering over, and clicking it. Instead of setting the material, you’ll destroy the referenced actor.

Hello all,

I haven’t been using Unreal Engine for long so I’m pretty new to blueprints.
I have a first person view game where I have randomly spawning objects in the scene.
Would anyone happen to know what could I write in a blueprint so I could delete these objects
during game by clicking on them?

Thanks

Hi.

I know two different ways to do that.

1- set the life time of your object from details panel.

2- promote the return of spawn node to a variable and use destroy actor node when you want.

I am currently away from home and can’t illustrate it for you

95867-life+time.png

1 Like

How are things going? Did this clear anything up?

he asked about destroying actors but your answer in about materials

Hi Guys,

Sorry for being a bit inactive. Being pretty busy here.
First of all thank you for your help.
I tried both solutions but had a little problem.

mcgraw! How did you call the “Active Pawn”? Is it a variable in your blueprint?

saeedc! For some reason I couldn’t tie an Onclick event to the DestroyActor function. Can you please help me how to do it?

Thank you guys

You missed what I wrote above the image.

Exactly. Create a variable ‘Active Pawn’ (feel free to name this whatever you wish) which is set on highlight/hit test (the middle row). Then you access it when you need to call Destroy Actor…

this is my character BP

I create a video for you check the video Unreal Engine 4 Answerhud How to Destroy Spawn Actor class with clic event. - YouTube

Good job.

Thank you very much for your help Guys!
I got it!