BindAction delegate with parameters

As of Unreal 4.18 an templated BindAction<>() was added.

To use it:

class AMyCharacter : public ACharacter
{
    // ...

    void Foo(int32 idx);

    DECLARE_DELEGATE_OneParam(FFooDelegate, int32);
};

void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInput)
{
    // ...
    PlayerInput->BindAction<FFooDelegate>("Foo", IE_Pressed, this, &AMyCharacter::Foo, 42);
}
10 Likes