Can some give me step guide on how to add widget component in actor cpp code?
hey I was running the same problem , and the thing is that you MUST include “UMG”,“Slate”,“SlateCore” in your ProjectName.Build.cs file .
then you can add the component in the actor as usual :
header file
class UWidgetComponent ;
public:
UWidgetComponent* WidgetComp;
Cpp file
#include “Components/WidgetComponent.h”
in the constructor :
WidgetComp = CreateDefaultSubobject(TEXT(“WidgetComp”));
Hope this help you!
have a great day
Is there a way to do this at runtime?