I have set up my UI using the Common UI, following the setup from this video: https://www.youtube.com/watch?v=TTB5y-03SnE.
Everything works as expected when using a single controller.
However, when I connect more than one controller, I encounter a peculiar issue.
Here’s the scenario:
Player 1 opens the menu, selects an item, and then closes the menu.
Later, when Player 2 opens the menu, the item Player 1 last selected remains in a hover state, even though Player 1 can no longer control it.
(In other words, the last item selected by Player 1 and the item currently selected by Player 2 are in hover view.)
To clarify, each time a menu is opened, I create a new widget instance, so I’m dealing with unique widget IDs (Widget->GetUniqueID() confirms they are different).
Does anyone have experience with or knowledge about this issue?
How can I ensure that when a new player opens the menu, the UI does not retain the hover state from the previous player’s interactions?
Open My Widget
UMyWidget* NewWidget = CreateWidget<UMyWidget>(PlayerController, MyWidgetClass);
NewWidget->AddToViewport();
NewWidget->ActivateWidget();
UMyWidget
void UMyWidget::NativeOnActivated()
{
Super::NativeOnActivated();
const UWorld* World = GetWorld();
APlayerController* PlayerController = GetOwningLocalPlayer()->GetPlayerController(World);
PlayerController->SetInputMode(FInputModeUIOnly());
GetDesiredFocusTarget()->SetFocus();
}
void UMyWidget::OnResumeButtonClicked()
{
const UWorld* World = GetWorld();
APlayerController* PlayerController = GetOwningLocalPlayer()->GetPlayerController(World);
PlayerController->SetInputMode(FInputModeGameOnly());
DeactivateWidget();
RemoveFromParent();
}