Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Editor garbage collecting meshes registered in EntitiesGraphicsSystem

Discussion in 'Graphics for ECS' started by Marc-Ducret, Feb 14, 2024.

  1. Marc-Ducret


    Apr 24, 2015
    Hello, I am trying to generate a chunk based terrain and having an entity per chunk with a runtime generated mesh, and the material is static, in a RenderMeshArray. This process also runs in edit mode.
    At first, it works well (Figure A), but after moving the scene camera for a while, the runtime meshes disappear. If I keep a reference (in a managed system) to the meshes for which the registered BatchMeshID is even, then only half of the meshes disappear (Figure B).
    It is a bit difficult to reproduce, and it would be rather painful to create a minimal reproduction project. Though I think the issue is rather clearly outlined by my experiment and has to do with some kind of garbage collection.

    I am using:
    Unity 2023.3.0b6,
    Entities Graphics 1.2.0-pre.6

    The issue definitely happens in Edit mode with the subscene closed, I am not sure about Play mode and/or having the subscene opened.

    Figure A
    upload_2024-2-14_21-58-43.png 5
    Figure B