Repository navigation
fix(unreal): 修正 PIE 退出时序与 LatentInfo 默认参数生成 - #2350
Merged
chexiongsheng merged 2 commits intoJul 29, 2026
Merged
chexiongsheng merged 2 commits into
chexiongsheng merged 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本 PR 修复 Unreal 侧的两个问题:
FEditorDelegates::EndPIE阶段过早销毁模块级 JavaScript 环境,导致 World 和 GameInstance 的脚本清理可能在 JsEnv 已失效后执行;LatentInfo="LatentInfo"元数据误识别为FLatentActionInfo的默认值,运行时因此出现ImportText错误。两个问题分别放在独立提交中,便于审查和按需合入。
问题说明
PIE World 清理前 JsEnv 已被销毁
FEditorDelegates::EndPIE的广播时机早于UEditorEngine::TeardownPlaySession完成 Play World 清理。原有实现会在收到
EndPIE后立即执行JsEnv.Reset(),并清理 TypeScript Generated Class 的重定向和动态调用器。但此时以下退出逻辑仍可能继续执行:这会导致脚本清理阶段访问已经销毁的运行环境。
原有
EndPIE路径还有一个疏漏:只释放了JsEnv,没有同步释放JsEnvGroup。LatentInfo元数据被当作默认参数对于 Blueprint latent 函数,Unreal 使用如下元数据指定 latent 参数:
这里的值表示 latent 参数名称,不是
FLatentActionInfo的序列化默认值。C# 默认参数生成器会先按参数源码名称查询函数元数据。当参数名为
LatentInfo时,该查询会错误命中上述元数据,并生成:FFunctionTranslator随后将字符串传给ImportText,产生错误:修改内容
调整 PIE 生命周期
EndPIE只更新 PIE 状态,不再销毁 JavaScript 环境;JsEnv、JsEnvGroup和 TypeScript Generated Class 重定向清理移动到FGameDelegates::GetEndPlayMapDelegate();EndPlayMap回调。调整后的退出顺序为:
修正 latent 参数元数据
LatentInfo元数据识别真实 latent 参数;FFunctionTranslator中保留运行时兼容保护,跳过旧生成产物中的非法LatentInfo="LatentInfo"默认值。两处改动各管一段:生成端修复保证新产物正确;运行时保护处理旧产物,修复前生成的
InitParamDefaultMetas.inl在重新生成前不会再触发ImportText错误。兼容性
JsEnvGroup现在与单 JsEnv 使用相同的 PIE 回收时机;