mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Check for UStevesGameViewportClientBase on first input change rather than at Initialize, the latter is too early
This commit is contained in:
parent
eead056575
commit
dd23ed77dd
@ -15,13 +15,7 @@ void UStevesGameSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
{
|
||||
Super::Initialize(Collection);
|
||||
CreateInputDetector();
|
||||
InitTheme();
|
||||
|
||||
auto GI = GetGameInstance();
|
||||
auto VC = Cast<UStevesGameViewportClientBase>(GI->GetGameViewportClient());
|
||||
if (!VC)
|
||||
UE_LOG(LogStevesUEHelpers, Warning, TEXT("Your GameViewportClient needs to be set to a subclass of UStevesGameViewportClientBase if you want full functionality!"))
|
||||
|
||||
InitTheme();
|
||||
}
|
||||
|
||||
void UStevesGameSubsystem::Deinitialize()
|
||||
@ -59,6 +53,18 @@ void UStevesGameSubsystem::InitTheme()
|
||||
|
||||
void UStevesGameSubsystem::OnInputDetectorModeChanged(int PlayerIndex, EInputMode NewMode)
|
||||
{
|
||||
// We can't check this during Initialize because it's too early
|
||||
if (!bCheckedViewportClient)
|
||||
{
|
||||
auto GI = GetGameInstance();
|
||||
auto VC = Cast<UStevesGameViewportClientBase>(GI->GetGameViewportClient());
|
||||
if (!VC)
|
||||
UE_LOG(LogStevesUEHelpers, Warning, TEXT("Your GameViewportClient needs to be set to a subclass of UStevesGameViewportClientBase if you want full functionality!"))
|
||||
|
||||
bCheckedViewportClient = true;
|
||||
|
||||
}
|
||||
|
||||
auto GI = GetGameInstance();
|
||||
auto VC = GI->GetGameViewportClient();
|
||||
auto SVC = Cast<UStevesGameViewportClientBase>(VC);
|
||||
|
@ -94,6 +94,7 @@ protected:
|
||||
protected:
|
||||
TSharedPtr<FInputModeDetector> InputDetector;
|
||||
FFocusSystem FocusSystem;
|
||||
bool bCheckedViewportClient = false;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
UUiTheme* DefaultUiTheme;
|
||||
|
Loading…
x
Reference in New Issue
Block a user