UE5 C++ 项目C#编译目标 链接模块

一.Engine里用C#来配置

1.UnrealEditor.Target.cs

cpp 复制代码
using UnrealBuildTool;
using System.Collections.Generic;

public class UnrealEditorTarget : TargetRules
{
	public UnrealEditorTarget( TargetInfo Target ) : base(Target)
	{
		Type = TargetType.Editor;
		IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
		BuildEnvironment = TargetBuildEnvironment.Shared;
		bBuildAllModules = true;
		ExtraModuleNames.Add("UnrealGame");
	}
}

Type类型设置为 Editor类型。(当前的项目为编译器服务)

Build的环境 设置为 共享。

bBuildAllModules 是否编译所有模块 是。(依赖的模块全部都编译)

额外模块 中 添加"UnrealGame",也就是把自己加入额外模块。

2.UnrealGame.Target.cs

cpp 复制代码
using UnrealBuildTool;
using System.Collections.Generic;

[SupportedPlatforms(UnrealPlatformClass.All)]
public class UnrealGameTarget : TargetRules
{
	public UnrealGameTarget( TargetInfo Target ) : base(Target)
	{
		Type = TargetType.Game;
		IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
		BuildEnvironment = TargetBuildEnvironment.Shared;

		ExtraModuleNames.Add("UnrealGame");
	}
}

Type为游戏类型(默认的Game,包含独立游戏,可能服务端客户端一样。并未指明),其他同上。

二.项目里

1.项目里也会有两个.Target.cs。一个Editor模块类型,一个Game模块类型。

2.项目和插件,至少需要带有一个.Build.cs 这样一个描述模块,才能编译进去。她是描述,模块的使用规则。

模块化是使用编译好的第三方库的资源,每个模块,本质是dll,lib。比如"Core"核心模块,"InputCore"负责当前输入输出的,"HeadMountedDisplay"用于VR的模块。

三.UPROJECT启动文件

1.文件在C++里本身格式是JSON格式。它启动,实际上是将路径传到引擎里,引擎来启动项目。

2.并且JSON里的具体信息,比如模块,插件包括参数,是否开启,需要哪些其它模块等,也都会传到引擎里,进行调配。再和之前配置好的模块进行关联。

3.插件的话,需要在工程里勾选需要的插件,它会自动在UPROJECT启动文件里,添加对应的问题。在模块描述的C#里,也将相应的插件写入(C++特定),即可成功。

相关推荐
HAPPY酷16 小时前
[UE5 避坑指南] 为什么打包后 UI 消失了?Launch Game 与强制加载
java·ui·ue5
晴夏。3 天前
unlua实现原理
游戏·ue5·ue4·lua·ue·unlua
晴夏。3 天前
UE Spawn出来的Actor的生命周期和管理方法
游戏·ue5·ue4·ue
晴夏。4 天前
UE垃圾回收的全方面讲解(通俗易懂)【底层实现、触发方式、引用保持、优化、工具】
ue5·游戏引擎·ue·垃圾回收
邪修king4 天前
UE5:C++ 实现 游戏逻辑 ↔ UI 双向联动
c++·游戏·ue5
HAPPY酷5 天前
从Public到Private:UE5 C++类创建路径差异全解析
java·c++·ue5
1204157137 肖哥8 天前
UE5.7 Procedural Vegetation分析
ue5
半天法师8 天前
Bug 记录:UE 结构体转 JSON 时 Key 字段大小写异常 (Editor 与打包后表现不一致)
ai·ue5·json·bug
邪修king8 天前
UE5 零基础入门第四弹:UMG UI 系统入门,从静态界面到逻辑联动
c++·ui·ue5
HAPPY酷9 天前
UE5 开发工具链配置清单
ue5