Subscribe to an input action that's given as property

Hi!
I want to subscribe to an input action in a blueprint, the thing is I want the input action to be given as a property to the actor. In C++ it seems it can be done with the BindAction function, but I can’t find equivalent in blueprint.

Also, I will explain the use case if it helps, I am developing an VR project, and I want to have an actor that separate all of the logic of the controller to a component, So that I want repeat each of their input for both, so I want to get the input action as variable for this controller component.

Thanks for help!

image

enable the input of player controller in your blueprint and you can access the input action

image

bear in mind the ‘consume’ property of actions:

image

if ticked then once the action is triggered, nobody else will received. If you want multiple blueprints to receive the same action turn consume off.

1 Like

Thanks, but it seems that myInputAction is still hard-coded to the blueprint, when I want it to be a property that can change (so that the left controller will subscribe to MenuToggleLeft and the right one to MenuToggleRight)

then what you looking for are dispatchers and just bind the calls to functions or events maybe?

in your player controller you can add dispachers like this:

image

then connect your action input to the call you want like this:

image

then in any actor you can bind that call to your function like this:

or even to a function:

you can do that in all the blueprints you want…when the action is triggered then it will invoke all the functions

2 Likes

I looked at event dispatchers and it seems like it can solve my problem, thanks!
I will still leave the thread if maybe someone has a solution to how to bind to variable input action, because using event dispatchers seems boilerplate-y and a bit hacky

lol is not hacky…that’s is the function of dispatchers…just multi generic triggers :slight_smile:

1 Like