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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/1/ce1cf6361e5ee46ed2b6e48678eea257f4dabe76.png)
enable the input of player controller in your blueprint and you can access the input action
![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/6/a168b34422ac5823ea5d444a7ed56ed4a2afd3e4.png)
bear in mind the ‘consume’ property of actions:
![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/3/e6384913c5ec0d4a6fd47966d3ec25c13ebfbf4a.png)
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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/f/06f492f239b177df0d0455616167d4e174873b8b.png)
then connect your action input to the call you want like this:
![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/d/ecdbd67bc419ac4dd8e6a0afde97fa4f3ac75cde.png)
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: :slight_smile:](https://d1ap1mz92jnks1.cloudfront.net/images/emoji/twitter/slight_smile.png?v=12)
1 Like