i’m following a tutorial on how to make a UI in UE4 with visual studio 2019 and i’v run into this error ( Error C2679: binary ‘=’: no operator found which takes a right-hand operand of type ‘TDecl SMenuWidget,RequiredArgs::T0RequiredArgs’ (or there is no acceptable conversion)) after some searching i found that the error comes from line 13 at MenuHUD.cpp.
can you give plaese me suggestions on how to fix this issue.
thanks in advance
MenuHUD.h
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "MenuHUD.generated.h"
UCLASS()
class REDIALMENU_API AMenuHUD : public AHUD
{
GENERATED_BODY()
protected:
TSharedPtr<class SMenuWidget> MenuWidget;
TSharedPtr<class SMenuWidget> MenuWidgetContainer;
virtual void BeginPlay() override;
};
MenuHUD.cpp
#include "MenuHUD.h"
#include "SMenuWidget.h"
#include "Widgets/SWeakWidget.h"
#include "Engine/Engine.h"
void AMenuHUD::BeginPlay()
{
Super::BeginPlay();
if (GEngine && GEngine->GameViewport)
{
MenuWidget = SNew(SMenuWidget).OwningHUD(this);
GEngine->GameViewport->AddViewportWidgetContent(SAssignNew(MenuWidgetContainer,
SWeakWidget).PossiblyNullContent(MenuWidget.ToSharedRef()));
}
}
SMenuWidget.h
#include "SlateBasics.h"
#include "SlateExtras.h"
/**
*
*/
class SMenuWidget : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SMenuWidget) {}
SLATE_ARGUMENT(TWeakObjectPtr<class AMenuHUD>, OwningHUD)
SLATE_END_ARGS()
void Construct(const FArguments& InArgs);
TWeakObjectPtr<class AMenuHUD> OwningHUD;
virtual bool SupportsKeyboardFocus() const override { return true; };
};