From 7baf07f29bdccd83b9fa62242de13938738d9423 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Mon, 26 Oct 2020 17:40:02 +0000 Subject: [PATCH] Support setting up Options widget content in design view --- Source/StevesUEHelpers/Private/StevesUI/OptionWidgetBase.cpp | 3 ++- Source/StevesUEHelpers/Public/StevesUI/OptionWidgetBase.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/StevesUEHelpers/Private/StevesUI/OptionWidgetBase.cpp b/Source/StevesUEHelpers/Private/StevesUI/OptionWidgetBase.cpp index af5152e..7352430 100644 --- a/Source/StevesUEHelpers/Private/StevesUI/OptionWidgetBase.cpp +++ b/Source/StevesUEHelpers/Private/StevesUI/OptionWidgetBase.cpp @@ -16,7 +16,6 @@ void UOptionWidgetBase::NativeConstruct() { GS->OnInputModeChanged.AddDynamic(this, &UOptionWidgetBase::InputModeChanged); UpdateFromInputMode(GS->GetLastInputModeUsed()); - ClearOptions(); } else UE_LOG(LogStevesUI, Error, TEXT("StevesGameSubsystem is missing!")); @@ -44,6 +43,8 @@ void UOptionWidgetBase::NativeConstruct() UE_LOG(LogStevesUI, Error, TEXT("%s should have a GamepadDownImage instance."), *this->GetClass()->GetName()); + // To support option set up in designer + SetSelectedIndex(SelectedIndex); } diff --git a/Source/StevesUEHelpers/Public/StevesUI/OptionWidgetBase.h b/Source/StevesUEHelpers/Public/StevesUI/OptionWidgetBase.h index 0794e1d..2fd51f9 100644 --- a/Source/StevesUEHelpers/Public/StevesUI/OptionWidgetBase.h +++ b/Source/StevesUEHelpers/Public/StevesUI/OptionWidgetBase.h @@ -118,7 +118,9 @@ public: protected: + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Content) TArray Options; + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Content) int SelectedIndex; virtual void SyncButtonProperties(UButton* Button) const;