[ESC] EnTT 学习记录 2

EnTT and Unreal 教程
https://entt.docsforge.com/master/entt-and-unreal-engine/#table-of-contents
BwdYeti/EnTTUE4
https://github.com/BwdYeti/EnTTUE4
UE4 C++ 教程
https://docs.unrealengine.com/4.27/zh-CN/ProgrammingAndScripting/ProgrammingWithCPP/IntroductionToCPP/
UE4 第三方库 教程
https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/ThirdPartyLibraries/
UE4 第三方库 教程
https://unreal.blog/how-to-include-any-third-party-library
HeyZoos/EnttUnrealTemplate
https://github.com/HeyZoos/EnttUnrealTemplate
bw2012/ue4_enable_c++17.txt
https://gist.github.com/bw2012/069bcb43d0983217dc36f782fc2f1bcc


本来打算在 UE4 上部署 EnTT,但是失败了,这应该是一篇失败记录hhh


一开始我是直接把

PCHUsage = PCHUsageMode.NoSharedPCHs;
PrivatePCHHeaderFile = "<PCH filename>.h";
CppStandard = CppStandardVersion.Cpp17;

放到了 build 的构造函数里面
比如我的游戏名叫 MUDTest,则 MUDTest.Build.cs 我写为

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class MUDTest : ModuleRules
{
   
	public MUDTest(ReadOnlyTargetRules Target) : base(Target)
	{
   
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] {
    "Core", "CoreUObject", "Engine", "InputCore" });

		PrivateDependencyModuleNames.AddRange(new string[] {
     });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true

		PCHUsage = PCHUsageMode.NoSharedPCHs;
		PrivatePCHHeaderFile = "<PCH filename>.h";
		CppStandard = CppStandardVersion.Cpp17;
	}
}

然后我新建了一个继承 Actor 的类,建好了之后这个类却不显示,Output 为

Message dialog closed, result: Yes, title: Message, text: Successfully added class ‘MyActor’, however you must recompile the ‘MUDTest’ module before it will appear in the Content Browser. Failed to generate project files.

说我需要重新构建工程,我重新构建了之后报了错,构建函数返回错误,所以就是说明我的构建函数这么写是不行的

注释掉我新加的三行,重新构建,没有报错,编辑器里就会显示新建好的类了

这样说来,编辑器不显示新建类,既可能是因为这个类继承 None,也可能是因为构建错误


之后看了 BwdYeti/EnTTUE4 才知道要改成什么样hhh
本来我确实是知道 PCH filename 该改的,但是我不知道 PCH 是个啥,所以就没管

但是我看到别人这么写的话,感觉就是工程名

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class EnTTUE4 : ModuleRules
{
   
	public EnTTUE4(ReadOnlyTargetRules Target) : base(Target)
	{
   
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		PrivatePCHHeaderFile = "PCH_EnTTUE4.h";
		CppStandard = CppStandardVersion.Cpp17;

因此对于我自己就是

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class MUDTest : ModuleRules
{
   
	public MUDTest(ReadOnlyTargetRules Target) : base(Target)
	{
   
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] {
    "Core", "CoreUObject", "Engine", "InputCore" });

		PrivateDependencyModuleNames.AddRange(new string[] {
     });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true

		PCHUsage = PCHUsageMode.NoSharedPCHs;
		PrivatePCHHeaderFile 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值