Crash on startup for Landscape Components

Hi! While migrating over to UE5.3 we are experiencing a crash on load of any level that contains a Landscape component (ULandscapeComponent). The root cause is that we create a MeshBatch in the editor only during the Landscape Proxy’s CreateRenderThreadResources, when we do this we need to give the elements a Uniform Buffer with the batch elements, and we want to use the Landscape Proxy’s Uniform Buffer. The issue is initialization order, when we create the Landscape it puts a request to create some of the render resources into a queue that will be processed in the next graphics frame, but it also sends a delegate to the render thread directly which sets the transform on the Landscape and calls CreateRenderThreadResources, which doesn’t create all render thread resources (such as the vertex uniform buffer on all SceneProxies). This delegate is being called before the init of the uniform buffer, so the MeshBatch we create in CreateRenderThreadResources is guaranteed to get passed nullptr as its UniformBuffer, which triggers a crash.

We have a workaround which is to make sure the UniformBuffer has at least been allocated (doesn’t need to be filled out, we just need the pointer to point the MeshBatch to) inside the Landscape’s CreateRenderThreadResources if we are going to be using it inside that function so this isn’t blocking us, but we were curious if there was something else that might be going on, because this would repro in any UE5 build and not just our project if this was the case.

Have you seen similar issues with the GrassMeshBatch on the Landscape Component? Have you seen what we’re seeing with the initialization order of the PrimitiveSceneProxy’s UniformBuffer vs a child’s CreateRenderThreadResources? It seems caching a MeshBatch like this is somewhat uncommon.

Steps to Reproduce
For us, just loading a Landscape Component in a map causes a 100% repro crash. We’ve got a local fix but we were wondering if this wasn’t indicative of something larger since we didn’t have divergences in the Landscape Component or any adjacent areas.

Hello,

Which version of the engine were you migrating from? The only change that comes to mind is:

CL#32998385 Fixed crash when landscape fixed grid vertex factory is not created : we would still create mesh batches regardless

This may not fix the issue you are seeing, but worth a shot.

We also have a known issue with experimental Virtual Height Fields, but this feature is deprecated and unlikely to be fixed:

Virtual Heightfield Mesh crash using released Vertex Factory

Have you seen similar issues with the GrassMeshBatch on the Landscape Component? Have you seen what we’re seeing with the initialization order of the PrimitiveSceneProxy’s UniformBuffer vs a child’s CreateRenderThreadResources?

We haven’t seen issues with GrassMeshBatch, the last one I found was a fix in UE 5.1 for LandscapePhysicalMaterials in CL#22240134

Hope this helps!