mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +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);
|
Super::Initialize(Collection);
|
||||||
CreateInputDetector();
|
CreateInputDetector();
|
||||||
InitTheme();
|
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!"))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UStevesGameSubsystem::Deinitialize()
|
void UStevesGameSubsystem::Deinitialize()
|
||||||
@ -59,6 +53,18 @@ void UStevesGameSubsystem::InitTheme()
|
|||||||
|
|
||||||
void UStevesGameSubsystem::OnInputDetectorModeChanged(int PlayerIndex, EInputMode NewMode)
|
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 GI = GetGameInstance();
|
||||||
auto VC = GI->GetGameViewportClient();
|
auto VC = GI->GetGameViewportClient();
|
||||||
auto SVC = Cast<UStevesGameViewportClientBase>(VC);
|
auto SVC = Cast<UStevesGameViewportClientBase>(VC);
|
||||||
|
@ -94,6 +94,7 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
TSharedPtr<FInputModeDetector> InputDetector;
|
TSharedPtr<FInputModeDetector> InputDetector;
|
||||||
FFocusSystem FocusSystem;
|
FFocusSystem FocusSystem;
|
||||||
|
bool bCheckedViewportClient = false;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite)
|
UPROPERTY(BlueprintReadWrite)
|
||||||
UUiTheme* DefaultUiTheme;
|
UUiTheme* DefaultUiTheme;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user