Hello Unity Developers,
I’ve been working on optimizing the Entities Graphics System, particularly focusing on reducing unnecessary memory allocations that occur due to property getters in RenderMeshArray
. I’ve noticed that accessing Meshes
and Materials
properties frequently during rendering can lead to significant performance drops due to repeated array copying.
To address this, I’ve created a patch that modifies the EntitiesGraphicsSystem
and RenderMeshArray
classes to use internal arrays directly instead of going through the property getters. This change has shown a noticeable reduction in memory allocations and an improvement in the execution time of the RegisterMaterialsAndMeshesSystem.RegisterMaterialsAndMeshes
method.
I’ve attached the patch file here for anyone facing similar issues or interested in improving the performance of their game’s rendering system. Please feel free to try it out and share your results or any feedback you might have!
9772398–1400589–0001-Prevented-unnecessary-allocations-of-Meshes-Material.zip (1.61 KB)