Destroy Actor not targeting desired actor
I have set up a system in which when the player has an invisible rectangle attached to their face, and when it overlaps with a specific actor, it will display a widget that informs the player to Press E. When the player presses E the actor is destroyed. This system works perfectly.
However, when I duplicate the same actor and now have multiple instances of that actor an issue arises. When the player aims their head at the original Actor I placed in the level (I'll refer to this actor it as Actor A) but does not press E, and changes to aiming at a duplicated Actor (I'll refer to it as Actor B) and Presses E, Actor A will be destroyed and not Actor B. Actor B is only destroyed after Actor A is. However, if I don't aim at Actor A and go straight to Actor B, and press E, Actor B is destroyed (the proper Actor)
This issue persists if I add more Actor's (I'll refer to it as Actor C). If I were to aim at Actor B first and Actor A but then go to Actor C and press E, Actor B will be destroyed, after one press, and Actor A will be destroyed after another and finally Actor C after another. I filmed a Youtube video illustrating the issue visually. Link to Youtube video: https://youtu.be/L3hZZVAQq6U
I can infer that whatever Actor I add into the game world, the one that was the first to be placed down is the one that is destroyed first. Either that, or I am not casting to the proper actor in blueprints. I am wondering if there is a fix for this. I am relatively new to Unreal Engine 4 so any help would be appreciated, thanks!
asked Jun 03 '18 at 04:42 PM in Blueprint Scripting
what may be happening is that the last one to be placed in the level or constructed is consuming the input from the player. to resolve this there are two things i can think of, first go to the section of the script where the input is and with the event selected go to the details panel and uncheck consume input. this should make it so the last constructed doesnt take the input and instead and actor that is affected by the input script should be, so potentially all the cubes will disappear. now to solve this issue just use an overlap event so the cubes can only be used if the player is within a certain range.
Follow this question
Once you sign in you will be able to subscribe for any updates here