UPCGStaticMeshSpawnerDataProvider dropping primitives

In CL 47382800 adrien.logut added an optimization that prevents copying PrimitiveDescriptors to the factory parameters in UPCGStaticMeshSpawnerDataProvider::SetupPrimitives():

[Image Removed]

Unfortunately, in this function there is an early exit that check if the descriptors are not empty:

[Image Removed]

In the case of the factory not being able to create primitives in this tick:

[Image Removed]

the code never reaches to this point in the next tick due to descriptors being already moved to the factory and the early exit on line 930. This leads to missing primitive instances. Please note that in some cases the number of dropped primitives can be large leading to severe visual bugs in the render.

The issue can be fixed either by not moving the descriptors out of the PrimitiveDescriptors member or by supporting this state in the early-exit code. Also note that UPCGSkinnedMeshSpawnerDataProvider::SetupPrimitives() does not suffer from this bug as the Move operation was never added there.

Hi Tomas and thanks for the report!

I might have been a bit too over eager with this it seems. I’ll make a Jira and poke you back when it is done.

Sorry for the trouble

Adrien

This should be fixed in UE5Main: 48760695

Don’t hesitate if you have other questions