I am trying to export an Unreal plugin, that has some Unreal modules dependencies, as a DLL, and later on import DLL to another Unreal plugin as Third Party Plugin. What is the best way to do it?
In the meantime I tried the following:
- From first Unreal Engine’s project I export plugin as .lib file (lets call the plugin
SDKPlugin
) - In second project I create a third party plugin called
MyPluginImplementation
where I will implement .lib and header files - Under
MyPluginImplementation/Source
I create new folderMyPlugin
(for current and future third party plugins and their things), and under it I createSDKPlugin
folder, as well asMyPlugin.Build.cs
. - Under
SDKPlugin
folder, I addinclude
andlib
folders. - In
include
folder I copied fromSDKPlugin
projectMyClass.h
,MyClass.generated.h
, andSDKPlugin.h
(as the compiler complained about it) - In
lib
folder I copiedSDKPlugin.lib
MyPlugin.Build.cs
looks like:
using System.IO;
using System;
using UnrealBuildTool;
public class MyPlugin : ModuleRules
{
private string ModulePath
{
get { return ModuleDirectory; }
}
private string BinariesPath
{
get { return Path.GetFullPath(Path.Combine(ModulePath, "../../Binaries/")); }
}
public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
{
Type = ModuleType.External;
LoadPlugin(Target);
}
public void LoadPlugin(ReadOnlyTargetRules Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
Path.Combine(ModulePath, "SDKPlugin/include"),
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"HTTP"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"HTTP"
}
);
PublicAdditionalLibraries.Add(Path.Combine(ModulePath, "SDKPlugin/lib/UE4Editor-SDKPlugin.lib"));
}
}
But when I try to add UMyClass
to MyPluginImplementation
I get bunch of compiler errors.
Does anyone knows where am I wrong?