How to delete spawned actor from array when looked at

Hi, I made a sample project where I can spawn and delete spawn-able actors. I add them to an array when spawned and then I have code setup to delete the last one spawned until there are no more left, however I cannot seem to figure out how to delete any of the spawned actors in any order i want by looking at them and pressing the button i want to use to delete them. I came close a few times but unfortunately didnt quite get there and didnt save the code for that. Here is my code for deleting the last actor from an array, how can I modify this to be able to delete any actor spawned from the array in any order and remove it from the index? I’ve been stuck on this for a few days now and any help would be appreciated. Thank you!

Also as a side problem, when actors spawn, they spawn halfway in the ground, not sure why that is.

Here is my code to spawn the actors in case you need it.

Hi Chay, not sure if I understand this correctly, but basically if you want to delete actors by looking at them, requires another line trace. So you would use the Line Trace node By Channel, set visibility Channel on the Actor mesh to Block, then the pin Out Hit Actor you do a equal object comparison if the line traced (sweeped) actor was hit. Then you set this actor in a actor variable, and on pressing a button you destroy that actor variable.
Generally you could also set an integer ID value (with expose on spawn) on each spawned actor individually, which could be handy which such task too.

Hi, yes when I spawn an object I want to be able to delete it when hit by a line trace and remove it from the array index when I press a button while looking at it. Basically kind of like shooting something and it disappears, in this case when i press C while looking at the spawned actor. I will try your suggestion and get back to you. Thanks!

I still cannot seem to get it working, is there any way you can show me visually?

This is what I tried but I am a little confused, I am still pretty new to BP