From code I want to assecc widget and and send string variable to it. But with my code I see only default value for it. Whet I set value in widget without code - it works.
Call method from another class:
UChangeDialogBottomText* changeDialogBottomText = CreateWidget<UChangeDialogBottomText>(
GetWorld()->GetFirstPlayerController(), UChangeDialogBottomText::StaticClass());
if (changeDialogBottomText)
{
changeDialogBottomText->UpdateDialogBotton();
}
.h
UCLASS()
class HOME_API UChangeDialogBottomText : public UUserWidget
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidget)) FString st_Name_Key;
UFUNCTION()
void UpdateDialogBotton();
};
.cpp
void UChangeDialogBottomText::UpdateDialogBotton()
{
st_Name_Key = "core";
}