[Newbie] Can't destroy actor

Hello.
I can’t destroy box with this BP, what am I wrong? It has no problem showing widget when I entering box collision.
I want to put several of these in world so I put it in BP.

The setup looks OK at a glance but there are some gotchyas here. Technical and logical.

Technical:

  • it does not work because of the E event - blueprint actors do not process input by default, it can be enabled in the class defaults of this object but…
  • this will trigger it in all (if not consumed) objects or one object (with highest input priority), or the last object placed in the level (if the priority is equal for all - don’t quote me on this, only 99% sure here)
  • there is a workaround for this, you could dynamically up the input priority of the object you overlap, but…

Logical:

  • wouldn’t it make more sense if it was the player who was responsible for the E action?
  • it only triggers once rather than per object and does not muddle the input priority chain

A solution here would be to check for overlaps in the player and use E action in the player to destroy it. You can use the pins on the overlap node:

  • get OtherActor
  • Cast To (cylinder)
  • create widget (or better, have a custom event in the cylinder object do it for you)
  • when the player press E, check for overlaps > destroy the overlapped actor