Reference UMG Widget variable

I’ve made an custom component which i will add to an actor. I want a variable that will hold a reference to an UMG widget. When i write “SUserWidget *DropdownMenu;” I get the error that its an Unrecognized type. I have tried to add headers that seems logical to add but i cant get it to recognize the type.
How do i make it to recognize the type?

Add UMG to your dependency modules in the build.cs file of your project.Something like below.Then regenerate project files so intellisense is updated.

PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore” ,“UMG”});

Then add this
#include “UMG.h”

to your includes and finally SUserWidget is for slate widgets, for UMG use UUserWidget or UWidget.

Thanks! I had to add Slate and SlateCore to the Dependency as well and also the following includes:
#include “Runtime/UMG/Public/UMGStyle.h”
#include “Runtime/UMG/Public/Slate/SObjectWidget.h”
#include “Runtime/UMG/Public/IUMGModule.h”
#include “Runtime/UMG/Public/Blueprint/UserWidget.h”