参照されているプラグインのディレクトリを取得します
.Build.cs 内のパスを取得し、それが存在するかどうかを確認し、マクロ コマンドを追加します。
string SVG = PluginDirectory.Substring(0, PluginDirectory.LastIndexOf("\\")) +
"\\HelloWorld\\Source\\HelloWorld";
bool bSVG = Directory.Exists(SVG);
PublicDefinitions.Add("HELLO_WORLD=" + (bSVG ? '1' : '0'));
依存関係を追加する
.Build.cs
List<string> modules = new List<string>();
modules.Add("Projects");
modules.Add("InputCore");
modules.Add("UnrealEd");
if (bSVG)
{
modules.Add("HelloWorld");
}
string[] s = modules.ToArray();
PrivateDependencyModuleNames.AddRange(
s
);
CPP での通話
HelloWorld プラグインを呼び出すプラグインの cpp
#if HELLO_WORLD
#include "HelloWorld.h"
#endif
void FToolModule::HelloWorld()
{
// load blueprint ..
#if HELLO_WORLD
THING::HelloWorld ::DoSomeTHing();
#else
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, "Not Found HelloWorld Plugin");
#endif
}