Skip to content
k-mods.com

Compatibility via KDataForge (soft dependency)

Ship a DataForge folder with your mod and add KAPI DataAssets like miners and resources from plain YAML, no KAPI build dependency required.

If you don’t want (or don’t need) to link against KAPI directly, you can still add compatible content (new resources, miners, and other KAPI DataAssets) by shipping a DataForge/ folder inside your mod with YAML packs. KDataForge resolves KAPI at runtime through Unreal reflection, so it works whether or not KAPI is even installed.

Unlike KAPI itself, KDataForge does not link against KAPI at build time:

  • KDataForge.uplugin’s Plugins array lists only SML, with no KAPI entry.
  • None of KDataForge’s four module .Build.cs files reference KAPI in PublicDependencyModuleNames.
  • Instead, KDFSubsystem.cpp resolves KAPI’s subsystem by string path through Unreal reflection, only if it’s actually present:
// KAPI is optional resolve and invoke via reflection so no link dependency exists.
if (UClass* KAPIClass = FindObject<UClass>(nullptr, TEXT("/Script/KAPI.KAPIDataAssetSubsystem")))
{
if (UGameInstanceSubsystem* KAPISubsystem = GameInstance->GetSubsystemBase(KAPIClass))
{
if (UFunction* ScanFunction = KAPISubsystem->FindFunction(FName(TEXT("StartScanForDataAssets"))))
{
KAPISubsystem->ProcessEvent(ScanFunction, nullptr);
}
}
}

This compiles and loads fine even with KAPI completely absent. The class lookup just returns null and the block is skipped. That’s what makes it a true soft dependency rather than an optional-at-compile-time hard one.