我想为虚幻引擎4插件构建一个通用的cmake库导入器。我想创建另一个类来处理它,并在多个插件上使用。如何在插件构建/Target.cs文件中包含这个新类?(https://github.com/caseymcc/UE4CMake)
发布于 2021-09-08 21:29:57
我想你可以把需要的代码放入一个空的插件中:
public class BuildSource : ModuleRules
{
public BuildSource(ReadOnlyTargetRules Target) : base(Target)
{
}
...
//what ever code you want to include in your builds
...
}然后使用uproject/uplugin文件添加插件:
{
"FileVersion": 3,
"EngineAssociation": "4.25",
...
"Plugins": [
{
"Name": "BuildSource",
"Enabled": true
}
]
}这将强制将BuildSource中的代码编译为程序集并包含到您的项目中(不需要导入)。如果您也在使用编辑器,则可能需要构建一个从IModuleInterface继承的空类,以使其正确链接。确保调用IMPLEMENT_MODULE(FBuildSourceEditorModule, BuildSource)来生成模块。
我目前正在对上面提到的代码使用它(https://github.com/caseymcc/UE4CMake)
https://stackoverflow.com/questions/64594830
复制相似问题