How to destroy actor by touching the screen anywhere?

Hey, I’m struggling with this problem the whole day! I’m new to unreal engine and I’m trying to make 2d tower-defense game. I have made this sequence: “the first actor” is spawned by touching the area on the screen, then by touching “the first actor” I need to spawn “the second actor” with another blueprint and by touching somewhere on the screen I want to know destroy last actor. The last part is stumbling-block…

  • P.S. consider that the first actor is a tower and the second one is it’s range and when I click on the screen I want to deselect tower (destroy it’s range actor)
  • P.P.S. if you know how to, for example, show the range of tower without creating special sprite - please let me know

hello, could you solve your problem mate? I am afraid I get the same problem :confused:

You could consider the following:

  1. Create an Array of Actors in Level Blueprint. Make this array Editable from other Blueprints.
  2. You could ‘register’ every object you spawn with that array in Construction BP.
  3. You could then get the length of the array and selectively call Destroy Actor on n-1 or any other element.

This answers your question, but I would not recommend this approach.