Quick answer: Unity Entities Graphics drawing wrong mesh after a runtime mesh swap? BatchGroup caches the mesh handle - register a new BatchGroup or update the cached handle.
DOTS-based units swap their mesh on level-up. Renderer keeps drawing the pre-upgrade mesh until a fresh frame.
Register new BatchGroup
var group = EntitiesGraphicsSystem.RegisterBatchGroup(
newMesh, newMaterial);Each unique (mesh, material) needs its own group; swap by assigning the new group to the entity.
Or use a shared mesh array
Pre-register a small array of upgrade-meshes; swap via index. Avoids per-swap registration cost.
Verify with the BatchRenderer debug
Window > Analysis > Entities > Batch Renderer. Lists active BatchGroups; orphan groups indicate the leak path.
“Entities Graphics caches per BatchGroup. Mesh swaps cross BatchGroup boundaries.”
For mesh-swap-heavy gameplay (loot, upgrades), pre-register every possible BatchGroup at level load. Swap becomes lookup; no per-frame registration.