Is Listen for Input action (IE Axis) in UMG working?

I am trying get in d-pad and analog stick input into my menus.

The UMG node Listen for Input Actions works for button presses but I can’t seem to get IE Axis to work nor do I see any way of getting the axis values.

Does the Listen for Input action work when the even type is set to IE Axis? Is there another way I should be doing this?

-Thanks

Ran into this issue myself today, don’t know if you’re still looking for an answer. Diving into the engine code, it doesn’t look like binding to an IE_Axis event does anything. In fact, IE_Axis is only in 3 places and it’s not actually used for anything.

If you have a code project you can set up your own function to listen for axis events though. First you need to create a C++ class inheriting from UserWidget and in its header declare the following:

DECLARE_DYNAMIC_DELEGATE_OneParam(FInputAxisDelegate, float, value);

UFUNCTION(BlueprintCallable, Category = "Input")
void ListenForAxisEvent(FName axis, FInputAxisDelegate func);

void OnAxisValue(float value, FInputAxisDelegate func);

and then in the .cpp file your function definitions would look something like this:

void UMyWidget::ListenForAxisEvent(FName axis, FInputAxisDelegate func)
{
	if (InputComponent == nullptr)
	{
		InitializeInputComponent();
	}

	FInputAxisBinding newBinding(axis);
	newBinding.AxisDelegate.GetDelegateForManualSet().BindUObject(this, &ThisClass::OnAxisValue, func);
	InputComponent->AxisBindings.Add(newBinding);
}

void UMyWidget::OnAxisValue(float value, FInputAxisDelegate func)
{
	func.Execute(value);
}

That should get you the behavior you want. Just make sure you have your input mode set to GameOnly or GameAndUI, I found that the axis values weren’t being updated if it was set to InputOnly.

Great stuff! I really appreciate this!

Hi there, is there any way to create a node equivalent of Stop Listening for Input Action / Stop Listening to All Input Actions using this method?

Thanks.

Please, could you explain step-by-step how to do this? (excluding how to install VS)

1 Like