Is there a way to have two parameters, instead of the usual float parameter, for delegate functions of an Axis input? It is like the solution given here, but with a BindAxis? Like:
void ARecActor::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
PlayerInputComponent->BindAxis("MoveForward", this, &AnActor::InputAxisDelegate, secondParameter);
void AnActor::InputAxisDelegate(float AxisVal, FString Something)
if (AxisVal != 0 && GEngine)
This won’t compile, as it is expected that delegates for Axis inputs must have only one float argument.
Template parameters (as explained in here) won’t work either, as the BindAxis method only accepts 3 parameters.
Thank you for your help!
I tried this:
OneParamAxisHandler.BindUObject(this, &ARecActor::BindInputAxisEvents, AxisName);
AxisBindingOneParam.AxisDelegate = AxisDelegate;
It is compiling, but the BindInputAxisEvent is not being called. I had to adapt line 4. from your example, because the Axis delegate is of a different type (UnifiedDelegate), so maybe my adaptation is doing something wrong?
Hello! You can take a look at this example and create an analog for axis binding
FInputActionBinding ActionBindingOneParam(ActionName, IE_Pressed);
OneParamActionHandler.BindUObject(this, &AMyCharacter::OnActionPressed, MyParam);
ActionBindingOneParam.ActionDelegate = OneParamActionHandler;