本篇博文介绍了,如果在UE 中如何使用第三方库,及制作成插件的方法。
DLL 文件是上篇文章中创键的具体的方法见上篇文章。下面开始介绍方法
首先,创建一个空白的 UE5 C++ 项目,然后再创建一个空白内容的插件,如下图所示
修改UeWllApi.uplugin 里面的内容 如下图所示
在 插件的文件夹中 ,添加文件夹及DLL,LIB,.H 文件(注意具体的路径不要错否则可能插件制作不成功)如下图所示
首先在插件中添加一个ThridParty的文件夹(文件夹名字不要错)如下图所示
然后在ThridParty 内再添加一个文件夹(WllApi)如下图所示
然后在 WllApi 里面添加三个文件夹 bin,inc,lib(名字不要错)如下图所示
然后再bin ,lib,分别添加x64 文件夹 inc 里面添加WllApi 文件夹 如下图所示
然后再bin ,lib,的x64文件夹下添加 Debug,Release 文件夹,然后在Debug,Release 里面添加对应的Dll ,lib文件,在inc 里面的WllApi文件夹下添加需要的头文件.如下图所示
在 插件的的Build.cs (UeWllApi.Build.cs)中添加以下代码
// Copyright Epic Games, Inc. All Rights Reserved.
using System.IO;
using UnrealBuildTool;
public class UeWllApi : ModuleRules
{
public UeWllApi(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
"Projects"
}</