Hi there, I have a question regarding PCG serialization. I don’t know if it’s something I’m totally misremembering, but I swear that with PCG the default used to be that PCG results for things like scattering meshes in a level were baked into the level at editor time.
However after finding that some very sizeable perf spikes we were seeing were from PCG graphs generating at runtime, I cracked open our graphs to see that I couldn’t find any option for “baked generation”. The only options are “On Load”, “On Demand” and “Runtime”.
I did try changing the graph to “On Demand” and it seems like it’s no longer doing the generation at runtime and the meshes are still there, but that name seems misleading. Is the intention that graphs should always be generated at runtime since that is the default? That, so far, isn’t super viable on mobile. Has the way generation has or is supposed to happen change
Hi Calin,
Thanks for reaching out.
First off, it’s always been this way - basically if it’s not already generated and it’s setup to generate at runtime, it will do so.
‘On Load’ means ‘it will generate when streamed in, if it’s not generated yet’.
‘On demand’ means ‘it will generate when a game event triggers this, and it’s not generated yet’ (* some caveats here for partitioned graphs that will generate on stream if their original component is on demand but has been generated).
‘Runtime’ means strictly runtime, and using the Runtime Generation Scheduler driven by generation sources, generally in pair with hierarchical generation.
In summary - if the PCG component has already generated, then it should not re-generate.
However, you have the option to mark your PCG graphs (preferred way) or PCG components to be editor-only too, as a safety measure too.,
Hopefully this clears the confusion.
Let me know if you have more questions,
Cheers,
Julien
As an aside - if you ran into cases where generation happens and you wouldn’t expect it, let us know.
We’ve fixed one such case recently (that had to do with On Demand in partitioned setups) but there might be something specific in your setup.
So yeah the issue is coming from:
‘On Load’ means ‘it will generate when streamed in, if it’s not generated yet’. Particularly the “if it’s not generated yet” part.
These graphs had definitely been generated already but were re-generating on load.
I’ll try the editor only part. That seems like a good call anyway since we’re never doing runtime generation.
But per your aside I would say that yes these were generating when we expected them to not be doing so.
Can you give me some details on the components that get regenerated when they shouldn’t?
E.g.
- Trigger
- Editing mode (I’ve assumed so far you weren’t using Preview, but that could explain it too)
- Partitioned or not
- Graph using hierarchical generation or not
Thanks!
Julien