Add code to project causes compilation errors

Using UE 4.6.1 C++ new project.
From Editor doing “Add Code to project”, “Show all classes”, and adding a WidgetBluepring.
After reloading and compiling I get:
error : Superclass WidgetBlueprint of class MyWidgetBlueprint not found.
The same error happens for just about any class I try to add this way.
Doesn’t this simple action supposed to work right out of the box?
Does anyone know what is the problem?

Try adding the UMG module to your module’s dependencies.

In YourGame.Build.cs:

		PublicDependencyModuleNames.AddRange( new string]
		} );

This should let the header tool know you want to use UMG classes, which WidgetBlueprint is. Then you’ll probably have to #include “UMG.h” in your MyWidgetBlueprint header if it’s not already done.


Thanks, It works now,

It works now
I guess I kind of assumed that their code wizard would be smart enough to throw in the the correct include statements as well (why else do they call it a Wizard?).
So thanks for the help.

It’s more of a gray wizard, it hasn’t really reached the level of white wizard yet.

The only thing you can assume is that you will need a workaround :wink: