Hi, i want to experiment a good way to handle input functions dynamically, and i thougth using dynamic delegate binding would be a nice idea, however my idea seems not working.
i want to setup input into my PlayerController’s SetupInputComponent, by binding actions with BindAction, but putting a dynamic delegate instead of a function, in order to call whichever function i bind into my delegate instance. i see that this does not work. can someone help me get rid of this problem somehow? Here’ a code sample below:
(the two “Change” functions simply unbind the delegate and bind with another void function)
DECLARE_DYNAMIC_DELEGATE(FCustomCommand) ← <- (my dynamic delegate)
InputComponent->BindAction(“CurrentCommand”, IE_Pressed, this, &AMyPlayerController::Command); ← <- (Here’s my problem! Command is a variable)
InputComponent->BindAction(“ChangeCommand A”, IE_Pressed, this, &AMyPlayerController::ChangeA);
InputComponent->BindAction(“ChangeCommand B”, IE_Pressed, this, &AMyPlayerController::ChangeB);