Hi, I have an input action mapping called “Drop” setup.
I have tried putting an “InputAction Drop” into my MyCharacter Blueprint and I can see this fire when I pressed the mapped key. There is only one instance of MyCharacter in the level.
However, the same event does not fire if I put “InputAction Drop” into another Blueprint which just consists of just a cube static mesh… (or at least it does not look like it fires in the Blueprint when in Play mode). There are multiple instances of this cube static mesh.
(I am trying to make it so that a player can pick up the cube and drop it… At the moment, I can get them to pick up, but not drop…)
By default only the controller and character receive player input. The easy bypass would be to set “player input” in the defaults of your BP to “Player 0”. That way it will receive input from the first player which works just fine for a singleplayer.
However for clean coding I would suggest catching the event in your character (or even controller) and then firing the event in any third actor via casts or saved values (e.g. if you pick up a cube. Save a reference to it in a “Picked up” actor variable).
You can not only use the same function from your character to do multiple things with different actors but you also won’t even wonder why something is doing something weird if you press button x because you handle all inputs in your controller (and maybe your character itself).
Debugging just gets easier. And reading that code as well… quite a lot!
That worked. Thanks! I now have the character being aware of the thing they picked up and then call this thing to detach when I hit my X button on the controller.
a bit of a bump but neccesary
i assume the event you mean is the player input. but how would i capture this and access it in a third party/actor/blueprint. is there any chance you could show me a blueprint that does this.