What headers do I need to reference UWidget?

I’m trying to create UPROPERTY that’s a UWidget* reference, but I can’t seem to find the header file that contains UWidget. I’ve tried all of these:

#include "Runtime/UMG/Public/UMG.h"
#include "Slate.h"
#include "WidgetAnimation.h"
#include "UMGSequencePlayer.h"

But I keep getting an “Unrecognized type ‘UWidget’” error.

Hi Jared

You should include #include “UMG.h”

Also you need add “UMG” to your project.build.cs file

Best regards,

Thank you very much, . I never would have found the answer tot his on my own. Your help is very much appreciated!

I case anyone else runs into this same situation, you need to add this line to your Build file, which is located in your \Project\Source\Project folder. Named YourProject.Build.cs. You need to add this line:
PrivateDependencyModuleNames.AddRange(new string[] { “Slate”, “SlateCore”, “UMG” });
in your project’s namespace. You may already have a line in there that adds “Slate” and “SlateCore” commented out. Just uncomment and add “UMG” then include “UMG.h” in your header/source.