Minor corrections to Mouse Click Handling

This commit is contained in:
baz 2025-09-04 00:21:32 +01:00
parent 1625c0012e
commit 3171771876
2 changed files with 8 additions and 3 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@
#include "CustomButton.h"
#include "StarterWeaponButtonDataObject.h"
#include "StarterWeaponButtonWidget.h"
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Components/ScrollBox.h"
#include "Kismet/GameplayStatics.h"
@ -36,7 +37,11 @@ void USelectWeaponWidget::NativeConstruct()
if (Buttons.Num() > 0)
{
Buttons[0]->SetKeyboardFocus();
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
{
UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(PlayerController, Buttons[0], EMouseLockMode::LockAlways);
PlayerController->bShowMouseCursor = true;
}
}
}
}