UE4 插件配置文件参数意义

发表于2018-01-25
评论1 6.4k浏览
本篇文章和大家介绍下UE4中的插件配置文件参数,让大家了解哪些插件配置文件参数是比较重要的。

插件示例
{
"FileVersion" : 3,
"FriendlyName" : "NDI Media Player",
"Version" : 3,
"VersionName" : "3.0",
"CreatedBy" : "Headcrash Industries LLC",
"CreatedByURL" : "https://headcrash.industries",
"DocsURL" : "https://github.com/ue4plugins/NdiMedia",
"EngineVersion" : "4.15.0",
"Description" : "Implements a media player using Newtek's Network Device Interface (NDI).",
"Category" : "Media Players",
"CanContainContent" : false,
"EnabledByDefault" : true,
"IsBetaVersion": false,
"Modules" :
[
{
"Name" : "NdiMedia",
"Type" : "RuntimeNoCommandlet",
"LoadingPhase" : "PreLoadingScreen",
"WhitelistPlatforms" : [ "IOS", "Linux", "Mac", "Win32", "Win64" ]
},
{
"Name" : "NdiMediaEditor",
"Type" : "Editor",
"LoadingPhase" : "PostEngineInit"
},
{
"Name": "NdiMediaFactory",
"Type": "RuntimeNoCommandlet",
"LoadingPhase" : "PostEngineInit",
"WhitelistPlatforms" : [ "IOS", "Linux", "Mac", "Win32", "Win64" ]
}
]

//官方文档部分说明

Name
必填
该插件模块的唯一名称,随着插件加载会加载该模块。在引擎运行时,插件的 Binaries 目录中应该有正确的插件二进制文件,以及对应的模块文件。对于带有 Source 目录的模块,一个相应的 *.Build.cs 文件也应该存在以模块的子目录中。

Type
必填
设置模块的类型。有效的几项是:Runtime,RuntimeNoCommandlet,Developer,Editor,EditorNoCommandlet,和 Program。这里的类型设置决定了该插件适合于那种类型的应用程序加载。比如插件中包含的某些模块,可能只是给 Editor 运行是使用的。 Runtime 的模块在无论何时都会被加载,哪怕是在最终发行的游戏版本中也会。Developer 的模块只会在 Development 运行时或者编辑器版本中才会被加载,并不在在最终发行版本中加载。Editor 模块只会随着 Editor 的启动被加载。插件也可以使用几种不同类型的组合来达到所需要的目的。

LoadingPhase
选填
定义该项时,用来控制插件在引擎启动的何时被加载。这是一个高级选项,通常并不需要做任何设置。有效的几个选择是 Default (在不定义 LoadingPhase 的时候),PreDefault,和 PostConfigInit。PostConfigInit 在引擎在开始加载核心的子系统前就加载该模块。PreDefault 在正常阶段前来加载模块。通常,需要定义这项是因为游戏模块需要依赖于该插件的 Content 内容,或者 Content 中定义的类型。

https://docs.unrealengine.com/latest/INT/API/Runtime/Projects/EHostType__Type/index.html   //加载插件环境类型

EHostType::Type
namespace EHostType
{
    enum Type
    {
        Runtime,  
        RuntimeNoCommandlet,  
        RuntimeAndProgram,
        CookedOnly,
        Developer,  
        Editor,  
        EditorNoCommandlet,
        Program,
        ServerOnly,  //只服务器
        ClientOnly,  //只客户端
        Max,   
    }
}
其余几项除了文档中有的其他暂时查不到做什么用(以后补充)

Type为Runtime之类的设置时,代表项目发布的时候插件也会被加载,需要设置发布平台:"WhitelistPlatforms" : [ "IOS", "Linux", "Mac", "Win32", "Win64" ],如果不加此行,默认为Building plugin for target platforms: IOS, HTML5, Win64, Win32。

"WhitelistPlatforms" :   开放的平台
"BlacklistPlatforms" :   关闭的平台
"EnabledByDefault": 设置是否项目打开默认启动

https://docs.unrealengine.com/latest/INT/API/Runtime/Projects/FPluginReferenceDescriptor/index.html   //插件配置参数介绍

如社区发表内容存在侵权行为,您可以点击这里查看侵权投诉指引