Type:
Editor:插件只能在编辑器有效
Runtime:代表打包出来也会有插件功能
Developer:开发者模式可以使用插件功能
Program:独立的小程序
ServerOnly:服务端可以使用插件功能
ClientOnly:客户端可以使用插件功能
LoadingPhase:
1、PostConfigInit:引擎初始化之前配置文件初始化之后进行加载
2、PreEarlyLoadingScreen:在coreUObject之前进行加载
3、PreLoadingScreen:在引擎完全被初始化之前进行加载
4、PreDefault:默认模块之前进行加载
5、Default:默认模块进行加载
6、PostDefault:默认模块之后进行加载
7、PostEngineInit:引擎初始化之后进行加载
插件依赖不能依赖Private的内容
如何在C++中使用插件:
Enable设置为true代表已经启动
.Build:做连接操作
.Target:做编译操作
一个插件至少含有一个模块
模块CoreTwo.Build.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class CoreTwo : ModuleRules
{
public CoreTwo(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine"});
}
}
主模块.Build.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class MyCTest : ModuleRules
{
public MyCTest(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Sockets", "Networking", "DesktopPlatform", "Json", "JsonUtilities", "Testor" });
}
}
主模块.Target.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class MyCTestTarget : TargetRules
{
public MyCTestTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange(new string[] { "MyCTest", "CoreTwo" });
}
}
主模块Editor.Target.cs:
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class MyCTestEditorTarget : TargetRules
{
public MyCTestEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange(new string[] { "MyCTest", "CoreTwo" });
}
}
主模块.uproject:
{
"FileVersion": 3,
"EngineAssociation": "4.27",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "MyCTest",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine",
"UMGEditor"
]
},
{
"Name": "CoreTwo",
"Type": "Runtime",
"LoadingPhase": "Default"
}
],
"Plugins": [
{
"Name": "Testor",
"Enabled": true
}
]
}
插件Testor.uplugin:
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "Testor",
"Description": "wangjunli created",
"Category": "Other",
"CreatedBy": "WJL",
"CreatedByURL": "https://blog.csdn.net/qqQQqsadfj?type=blog",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": false,
"Modules": [
{
"Name": "Testor",
"Type": "Runtime",
"LoadingPhase": "Default"
}
]
}
总结:
在Build.cs里面包含插件,在Target和Editor.Target内包含模块,在.uproject内包含模块和插件,并使插件设置为使用