I am trying to add a widget to the viewport in C++. This is something I have done plenty in the past, but there seems to be an error I just can not figure out.
The error I get is pretty self explanatory, but I can not figure out why I would be getting it.
...ProjectHUD.cpp(62): error C2039: 'AddToViewPort': is not a member of 'UUserWidget'
...unrealengine\engine\source\runtime\umg\public\Animation/WidgetAnimationBinding.h(10): note: see declaration of 'UUserWidget'
Project.Build.cs
PublicDependencyModuleNames.AddRange(
new string[] {
"Core",
"CoreUObject",
"Engine",
"InputCore",
"SlateCore",
"Slate",
"UMG",
"OnlineSubsystem",
"OnlineSubsystemUtils"
}
);
MyProject.h
#include "Runtime/UMG/Public/UMG.h"
#include "Runtime/UMG/Public/UMGStyle.h"
#include "Runtime/UMG/Public/Slate/SObjectWidget.h"
#include "Runtime/UMG/Public/IUMGModule.h"
#include "Blueprint/UserWidget.h"
ProjectHUD.h (No special includes for widgets here, they are in the Project.h above. I have tried them here though)
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "User Interface")
TSubclassOf<UUserWidget> LoginMenuClass;
UPROPERTY(BlueprintReadOnly, Category = "User Interface")
UUserWidget* CurrentWidget;
ProjectHUD.cpp (No special includes for widgets here, they are in the Project.h above. I have tried them here though)
CurrentWidget = CreateWidget<UUserWidget>(PlayerController, LoginMenuClass);
CurrentWidget->AddToViewPort(); // Problem is here
I am at a loss here and would appreciate any feedback anyone has!
Thanks.