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++特定),即可成功。

相关推荐
draracle6 小时前
如何将 cryptopp库移植到UE5内
ue5
龙智DevSecOps解决方案1 天前
Perforce演讲回顾(上):从UE项目Project Titan,看Helix Core在大型游戏开发中的版本控制与集成使用策略
游戏·ue5·源代码管理·perforce·helix core
我救我自己3 天前
UE5.4.3 录屏回放系统ReplaySystem蓝图版
java·前端·ue5
cainiao0806054 天前
UE4/UE5开发资源
ue5·ue4
charon87785 天前
Unreal 实现建造游戏|地面交互shader
游戏·ue5·游戏引擎·虚幻
周周的Unity小屋5 天前
UE5蓝图实战:动态墙上挖坑与自定义坑尺寸
ue5·蓝图挖坑
@Unity打怪升级7 天前
Unity 与虚幻引擎对比:两大游戏开发引擎的优劣分析
游戏·unity·ue5·游戏引擎·ue4·游戏程序·虚幻
timidcatt8 天前
独立游戏《Project:Survival》UE5C++开发日志0——游戏介绍
c++·游戏·ue5
charon87788 天前
Unreal Engine 5 C++: 插件编写03 | MessageDialog
c++·ue5·游戏引擎·虚幻
charon87789 天前
UE5: Content browser工具编写02
c++·ue5·游戏引擎