I create a widget with a button in it. I use the sidescroller example for testing things. I dont get it working. By clicking the button the character should move right. I tried a lot of different things. How should the blueprints look like to get it working. I would really appreciate your help!
In the character, add an event. Hook it up to the add movement input. It should look almost as it does now, but instead of a input axis event, it’s your custom event.
Set the scale value to 1 in the add movement input node.
Now, in the widget bp, drag off the character node and call your custom function.
That’s it.
Yeah, you’re getting the playercontroller and casting it as character. It fails.
Get player controller - get controlled pawn - cast as sidescrollercharacter.
But the event is just called one time. I have to click thousand times to move the character. I thought the event is called all the time until I release the button. Sorry my english is not the best. I hope you can understand what I mean.
Okay. So now that there’s basic functionality, you can change it to be more practical. Instead of calling the movement input directly from the function, you can set a boolean.
And you need to add a ‘on release’ event on the button, which sets the boolean to false.
And each tick, you check the boolean. If it is true, call the movement input.