UI loses ability to be clicked

I have setted up a widget, ArrowWidget, that shows when an arrow is pressed, and hides when it’s clicked somewhere else other than the widget itself, when the widget is shown i can hover with the mouse on one of the 3 buttons or i can click one of them and the OnHovered and OnClicked event are all handled correctly, all works fine untill i put on pause the game.

When i put on pause the game and load the PauseGameWidget and hide the SelectAnswerWidget with a button that i made, the game correctly stops and when i unpause the game and unload the PauseGameWidget and show the SelectAnswerWidget and i click on the arrow the ArrowWidget correctly shows but now when i click on one of the buttons of the widget the widget hides like i pressed not on it’s button but somewhere else.

It feels like the the widget has “lost” its ability to “catch” clicks.

I am in a pickle, can someone help?

In the image as you can see the green arrow is pointing on the problematic widget, all the other ui is from another widget called SelectAnswerWidget.

I made all the classes in c++.

How is the problematic widgets visibility set? Is the button that is supposed to be clicked set to visible or Not Hit-Testable?

Is the widget set to focus once you create it?

Is your input set to “Game Mode Only” by any chance? (it would ignore widgets).
It needs to be “Game And UI” or “UI Only”.

  1. The visibility in the UMG is set for all the elements to Visible (UI_ArrowWidget,CanvasPanel,ButtonUp,ButtonLeft,ButtonRight)

  2. In the NativeConstruct of the cpp file of the ArrowWidget i typed: this->SetFocus(); and every time i check this boolean with this->HasMouseCapture() i can see that it result false, and i really do not understand why

  3. I don’t know where to look to see how my input is setted, i have used the new enhanced input mapping context and and input actions and in my characterController i setted this way (image) and in the characterController.cpp file i set it up this way

void AOperaCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{

	UEnhancedInputComponent* EnhancedInputComponent = 
    Cast<UEnhancedInputComponent>(PlayerInputComponent);
	
	// Enhanced inputs

	EnhancedInputComponent->BindAction(ClickAction,ETriggerEvent::Triggered,this,&AOperaCharacter::LMBClicked);
	
}

c++ version is

	APlayerController * PCon = UGameplayStatics::GetPlayerController(GetWorld(), 0);

// game and ui

	UWidgetBlueprintLibrary::SetInputMode_GameAndUIEx(PCon, nullptr, EMouseLockMode::DoNotLock);

// ui only

UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(PCon, nullptr, EMouseLockMode::DoNotLock);

you need to include

include “Kismet/GameplayStatics.h”
include “Blueprint/WidgetBlueprintLibrary.h”

and add the UMG module to your build file Dependency Module Names.

You can also call this if you are creating the widget from c++ and pass in the new widget as the focus in place of nullptr that is default.

Or you can do it in blueprints.