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"
UCLASS()
class MyClass : public UClass {
GENERATED_BODY()
}
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[] {
"MyPlugin/Public",
});
PrivateIncludePaths.AddRange(new string[] {
"MyPlugin/Private",
});
PublicDependencyModuleNames.AddRange(new string[] {
"Core",
// Additional public dependency modules here
});
PrivateDependencyModuleNames.AddRange(new string[] {
"CoreUObject",
"Engine",
// Maybe also "Slate" and "SlateCore"
// Haven't tested without these
// Also additional dependencies here
});
DynamicallyLoadedModuleNames.AddRange({
// Dynamically loaded modules here
});
}
}