UE4/5 插件分拆 《第一季》VoxelFree运行时地形02 项目和插件居然是同一个东西

本文介绍了如何将UE4/5的插件模块转换为项目模块,通过修改.uproject文件和源代码路径,实现模块在项目与插件间的迁移。在过程中,探讨了ModuleDescriptor.h和ProjectDescriptor.h的枚举,以及Module的加载阶段。虽然尝试禁用引擎插件以加快启动速度未见成效,但展示了模块的动态加载、卸载和重编译能力,为C++开发提供了便利。
摘要由CSDN通过智能技术生成

 继续上一篇,用写字版打开新建的C++ 和 Blueprint Project 下唯一的 .uproject 文件

以及插件目录下的.uplugin 作个对比,会发现都是json格式

 C++ 下无论是项目还是插件,Modules的格式都是一样的

	"Modules": [
		{
			"Name": "TestPlug01",
			"Type": "Runtime",
			"LoadingPhase": "Default"
		}
	]

其中 Name = 插件名称

根据这个名称,可以在目录\Source下找到一一对应Name的目录名

另外两个参数 Type 和 LoadingPhase 顺着文本搜索全引擎,可以找到

\Engine\Source\Runtime\Projects\Public\ModuleDescriptor.h 下的枚举

Type 的值对应着

	enum Type
	{
		// Loads on all targets, except programs.
		Runtime,
		
		// Loads on all targets, except programs and the editor running commandlets.
		RuntimeNoCommandlet,
		
		// Loads on all targets, including supported programs.
		RuntimeAndProgram,
		
		// Loads only in cooked games.
		CookedOnly,

		// Only loads in uncooked games.
		UncookedOnly,

		// Deprecated due to ambiguities. Only loads in editor and program targets, but loads in any editor mode (eg. -game, -server).
		// Use UncookedOnly for the same behavior (eg. for editor blueprint nodes needed in uncooked games), or DeveloperTool for modules
		// that can also be loaded in cooked games but should not be shipped (eg. debugging utilities).
		Developer,

		// Loads on any targets where bBuildDeveloperTools is enabled.
		DeveloperTool,

		// Loads only when the editor is starting up.
		Editor,
		
		// Loads only when the editor is starting up, but not in commandlet mode.
		EditorNoCommandlet,

		// Loads only on editor and program targets
		EditorAndProgram,

		// Only loads on program targets.
		Program,
		
		// Loads on all targets except dedicated clients.
		ServerOnly,
		
		// Loads on all targets except dedicated servers.
		ClientOnly,

		// Loads in editor and client but not in commandlets.
		ClientOnlyNoCommandlet,
		
		//~ NOTE: If you add a new value, make sure to update the ToString() method below!
		Max
	};

很多是不是,到目前为止我只见过 "Type":"Runtime" 和 "Type":"Editor" 这2种用法,当然了,我是小白。

LoadingPhase 同样对应着枚举

enum LoadingPhase
	{
		/** As soon as possible - in other words, uplugin files are loadable from a pak file (as well as right after PlatformFile is set up in case pak files aren't used) Used for plugins needed to read files (compression formats, etc) */
		EarliestPossible,

		/** Loaded before the engine is fully initialized, immediately after the config system has been initialized.  Necessary only for very low-level hooks */
		PostConfigInit,

		/** The first screen to be rendered after system splash screen */
		PostSplashScreen,

		/** Loaded before coreUObject for setting up manual loading screens, used for our chunk patching system */
		PreEarlyLoadingScreen,

		/** Loaded before the engine is fu
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值