Setting up the property system

Hello there,

The main game module seems naturally set up for the property system, but I’m struggling trying to add support for the property system to plugins. I’ve added the CoreUObject module to the public dependencies of the plugin and added the #include ScriptManager.generated.h as the last #include directive and inherit from UClass.

However I get a huge list of errors mostly if not all deriving from the very first in the list:

error C2504: 'UClass': base class undefined

If I now try to #include "UObject/Class.h" I get a new list of errors all originating in UObject/Class.h referring to undeclared identifiers.

Obviously I’m doing something wrong. But what?

Thank you in advance!

Are you creating the plugin via the plugin wizard? If so, which type? I ask because generally the wizard should add the relevant base dependencies. Others you will have to add yourself.

I did add it through the plugins wizard as a third party plugin. I had planned to build a wrapper around that third party plugin.

I found the solution. I failed to #include "Engine.h" in the respective file. It is now working flawlessly.

This is how the bare bones MyClass.h file should look like:

#include "MyPluginPrivatePCH.h"
#include "Engine.h"
#include "MyClass.generated.h"

class MyClass : public UClass {

For the sake of completion, the MyPlugin.Build.cs bare bones file ought to look like this:

public class MyPlugin : ModuleRules {
    public MyPlugin(TargetInfo Target) {

        PublicIncludePaths.AddRange(new string[] {

        PrivateIncludePaths.AddRange(new string[] {
        PublicDependencyModuleNames.AddRange(new string[] {
            // Additional public dependency modules here
        PrivateDependencyModuleNames.AddRange(new string[] {
            // Maybe also "Slate" and "SlateCore"
            // Haven't tested without these
            // Also additional dependencies here
            // Dynamically loaded modules here

Isn’t Engine.h included by the wizard by default?

For the plugin’s main source file, yes. I was adding another file next to that file which lacked that header. For that I did not use the Editor’s Add C++ Class wizard as I find it too time consuming to switch back and forth between the editor and the IDE. I simply forgot that substantial include. :confused: