Skip to content

Instantly share code, notes, and snippets.

@PapeCoding
Last active March 9, 2020 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PapeCoding/e799a87334916d431c1f64947b3240bb to your computer and use it in GitHub Desktop.
Save PapeCoding/e799a87334916d431c1f64947b3240bb to your computer and use it in GitHub Desktop.
This allows binding "keys" to functions indirectly, by introducing a unique action, which calls your method with your parameter(s).
// Declare inside your Unreal Class
DECLARE_DELEGATE_OneParam(FMyActionDelegate, float);
//Do in function like BeginPlay or the StartupModule function of your Plugin
UInputSettings::GetInputSettings()->AddActionMapping(FInputActionKeyMapping(TEXT("MyTestAction"),EKeys::T));
UInputSettings::GetInputSettings()->SaveKeyMappings();
InputComponent->BindAction<FMyActionDelegate>(TEXT("MyTestAction"),EInputEvent::IE_Pressed,this,&MyClass::MyFunctionHandler,-0.1337f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment