How can I destroy an actor while overlapping with a collision box?

I’m trying to destroy an actor when I press “E” and while the player is overlapping a collision box but I can’t get it to work. I’ve tried to many tutorials and I’m stumped. The overlapping works but pressing “E” Still does nothing.

I’m currently on 4.27, any help is greatly appreciated. Thanks

It looks ok. So the overlap message triggers, but the destroy not? Do you keep getting the overlap message?

I’ve done this with UE5 and there are no issues.
You need to provide the link of the character to be destroyed in the destroy target part.
Also you don’t need to use visibility for a character that will be destroyed anyway.
You can try it like in the video I prepared.

1 Like

The overlap message triggers when I enter and the non overlap messages when I leave it. But the destroy never triggers.

Does any of the stuff on the E-chain fire?

1 Like

I’m using a collision box in the blueprint itself and want the object to disappear but the player to stay alive. I can’t figure it out

Nope, none of the blueprints on E trigger. I’m guessing it’s because I’ve put it in the BP of the item being destroyed and not the player? Somehow need it to trigger when the player does it

The code is a bit over the top, and actor overlap works better than component. Try more like this:

Thank you for the help but it’s still not working for me. Should I be putting this in the Actor being destroyed BP or the ThirdPersonCharacter?

I’ve currently got it in the actor being destroyed and even a simple “E Pressed - Print Hello” isn’t working in there.

Hey! I think this video will do the trick
I didn’t work according to your code, but I used the same system.
You can use the actor’s own blueprint system you want to destroy.

You can watch from the 2nd minute.

Thank you for the video, I’ve just tried it out and it hasn’t worked for me. It doesn’t seem to pick up any inputs on the BP that the character is pressing.
The object I’m trying to destroy is a Character ClassBP so that might be something to do with it?

Enable input on the blueprint manually:

Still doesn’t seem to work when using a CharacterBP. I’ve made a version using the ActorBP and it works. Just trying to figure out if that’ll be okay since I wanted them to be an enemy AI

I think everybody here is assuming this code is in an actor. You can’t have this code in the character.

Ah sorry that’s my bad for not realising it soon. I might have to find another way to have the enemies destroyed like that then, since ActorBP can’t have movement from what I can see

Ah, it’s an enemy, that’s different.

As long as the enemy is a character and the player overlaps with the AI collision, and you enable input on the AI.

Yeah so the plan was to have a collision box on the back of some enemies so that when the player walked up and entered the collision box and pressed E, the enemy would be destroyed. If done the exact same code that you’ve suggested on the an Actor and it works perfectly, but doesn’t work on the enemy

I’m guessing the input isn’t enabled on the AI. Have you enabled it?

The Auto Receive Input option is currently set to Player 0 on the AI

Ok, good.

I was just about to google this, and remembered: You can’t enable input on AI, I don’t think.

It will work if you make a custom event in the AI, and call that instead of trying to get keyboard input working. It’s because your keyboard input is already on your player.