在游戏运行时调用pcg,无法生成pcg数据

之前是5.4版本,运行的时候可以调用即时生成,但是打包出来无法生成,我们暂时没有去查原因。

升级到5.6版本以后,运行的时候也无法即时生成了,甚至不需要打包测试。

目前只有提前生成好数据可以暂时用着,但是这样就和直接刷上去没任何区别了,所以想尝试解决一下。

后面log报错如下:

LogPCG: Error: PCG Landscape cache (on the PCG World Actor) is not set to be serialized and will not work in non-editor modes.

LogPCG: Error: PCG Landscape cache (on the PCG World Actor) is not set to be serialized and will not work in non-editor modes.

LogPCG: Error: [BP_PCGSetBase_C_1 - AttributeSelect_3 (Select [Content removed] encountered 0

[Image Removed]

已经按照AI建议改了方法,并且清除了缓存,但是还是一样。

这是调用蓝图和设置 [Image Removed]

[Image Removed]

[Image Removed]

[Attachment Removed]

你好

感谢您提供的信息。

从Log中的报错来看,前两个应该是因为您第一张图中的Serialization Mode设置为了Never Serialize。所以Log报错告诉您,当前PCG在非编辑模式下不会工作。第三个报错,应该是在BP_PCGSetBase中,有一个节点没有输入值。

在您上传的第三张图中,Generation Trigger 您选择了 Generate on Demand。也就是说相应的数据只有您主动触发才会生成。如果您需要数据在加载关卡的时候生成,您可以试试GenerateOnLoad。如果你需要在运行时实时生成,您也可以试试使用Generate at Runtime。

这里有一个官方的文档链接,希望对您有所帮助。

https://dev.epicgames.com/documentation/zh-cn/unreal-engine/using-pcg-generation-modes-in-unreal-engine

如果您还有后续的问题,可以与我联系。

谢谢

Henry Liu​

[Attachment Removed]