Hey, everybody.
I found a strange behavior of rendermeshsystemv2 system in the profiler.
I created an empty scene with a cube (an entity with Translation and RenderMesh components) on it.
var entityManager = World.Active.EntityManager;
var testCube = entityManager.CreateArchetype(
typeof(Translation),
typeof(RenderMesh),
typeof(LocalToWorld));
var cubeEntity = entityManager.CreateEntity(testCube);
entityManager.SetSharedComponentData(cubeEntity, new RenderMesh
{
mesh = _cubeMesh,
material = _cubeMaterial
});
EntityManager.SetComponentData(cubeEntity, new Translation
{
Value = _cubeTranslation
});
After starting the scene, I see my cube on the screen, but I also see periodic peaks in the profiler caused by the garbage collector. The profiler shows that garbage is created in the unity.rendering.rendermeshsystemv2 → updatedynamicrenderbatches → soft shared renderers (please see attached screenshot)
Obviously, these peaks will reduce perfomance, and if the problems appear on such a simple test scene that means I’m definitely doing cube creation wrong
Please advise what I’m doing wrong.