欢迎光临散文网 会员登陆 & 注册

FGameplayTag与错误代码1073741819

2023-08-20 01:50 作者:末日时你吃了吗  | 我要投稿

In UE4 C++, attempting to use the FGameplayTag::RequestGameplayTag method to define static or const FGameplayTag variables may lead to memory errors.

You may encounter the following scenarios:

· packaged game cannot open 

· error code: -1073741819

Moving all the static or const FGameplayTag variables that you defined may solve the problem. As an alternative, you can consider using the "define" keyword.

这是一个巨坑,我现在敲这段话的时间是凌晨零点四十五分,它比这个时间点还坑。

长话短说,打包启动时遇到错误 代码1073741819,形式如下:

错误原因 :FGameplayTag::RequestGameplayTag 该方法不能用于定义static变量或const 变量。

需要注意的是上述错误代码只会在 点击Launch按钮 - 选择LapTop xxxx后出现。若不是以这种方式打包启动,而是直接在打包完成之后,双击游戏图标,它完全不会启动,也不会提示任何错误信息。


本人目前使用的UE4版本为 4.27,并不清楚UE5是否有类似情况。


以下演示两种 错误方式 

错误方式一

错误方式二

需要再次强调的是,上面两种方法都是错误的,它们虽然可以在PIE或Standalone模式下顺利运行,但无法在打包后成功运行,会出现内存不能为read错误提示,即错误代码 1073741819.


可以考虑使用 define 的方式

示例:



参考链接(Reference):

https://forums.unrealengine.com/t/error-1073741819-exitcode-1-error-unknown/508000
https://blog.csdn.net/cartzhang/article/details/120160693

顺便一提,本人其实今天早上就读过了这两篇文章,并尝试在第一时间移除所有的static FGameplayTag,但是天杀的,唯独有一个我定义在其他类中的 const FGameplayTag 被我遗忘了,导致我多绕了一大堆路,一度想哭。555。

最后是通过复制Source文件夹、Config文件夹和启动图标,重新生成了一个项目,确保问题在于代码之后,控制变量,一点点都移除可能出现问题的代码,最后才锁定到那个可恶的const FGameplayTag。



FGameplayTag与错误代码1073741819的评论 (共 条)

分享到微博请遵守国家法律