i designed four widget in ue4 blueprint. my first widget is playing menu options i put one button in this widget i click the button it will go to the another widget and another widget has three buttons. That the three buttons are placed in 30% of the left side screen i click the first button the another widget will be come in another 70% of right screen and i click the second means its will also display the widget but the first button widget and second button widget the both widget are displayed how to remove the widget . i click the first widget button means its will display the first widget and i click the second button means its will display the widget in back side of the widget the first widget will be does not hidden. help to solve this problem
in .cpp
void AJacobPlayerController::JoinGameMenu()
{
UE_LOG(LogTemp, Warning, TEXT("JacobPlayercontroller JoinGameMenu"));
OnEnterState(AJoinGameMenuHUD::StaticClass(), false);
}
in .h
UFUNCTION(BlueprintCallable, Category = PlayerController)
void JoinGameMenu();
UPROPERTY()
TSubclassOf<UUserWidget> MainWidgetClass;
UPROPERTY()
UUserWidget * MainWidget;
i put the widget in hud i put the coding below
in .h
class MYPROJECT3_API AJoinGameMenuHUD : public AHUD
{
GENERATED_BODY()
protected:
UPROPERTY()
TSubclassOf<UUserWidget> MainWidgetClass;
UPROPERTY()
UUserWidget * MainWidget;
public:
AJoinGameMenuHUD();
};
in .cpp
AJoinGameMenuHUD::AJoinGameMenuHUD()
{
static ConstructorHelpers::FObjectFinder<UObject>NewMainWidgetClass(TEXT("WidgetBlueprint'/Game/ThirdPerson/Widget/Server/JoinGameMenu.JoinGameMenu_C'"));
MainWidgetClass = (UClass*)NewMainWidgetClass.Object;
MainWidget = CreateWidget <UUserWidget>(GetWorld(), MainWidgetClass);
if (MainWidget)
{
MainWidget->AddToViewport();
}
}
in join menu hud is the second button widget i created the first button that also the same coding