Search Unity

Bug Entities without RenderMeshArray cause not updating positions of entities

Discussion in 'Graphics for ECS' started by StefanWo, Apr 4, 2023.

  1. StefanWo

    StefanWo

    Joined:
    May 24, 2015
    Posts:
    122
    I had a very strange behavior. Some of my Entities were not updating their position and stay at the position where they were rendered the first time (like they are static). It lookes like the Material overwrites (by entity components) were also not applied. I update the entities via the LocalTransform. Due to the entity inspector, the LocalToWorld changed as expected, but they are rendered at the old position.
    I use Unity 2022.2.13 with Entities 1.0.0-pre.65

    I nailed it down and came to a strange bug:
    After loading the scene i converted the "static" usage of the RenderMeshArray to the a Runtime Mesh (so i pick the mesh/material from the MaterialMeshInfo and RenderMeshArray, registered it in the EntitiesGraphicsSystem and updated the MaterialMeshInfo with the new IDs), so i can also use it for other references in other objects for the whole game.
    After that i removed the RenderMeshArray from the Entity, due to its not needed anymore. That caused the problem. When i keep that RenderMeshArray in the Entity, it works fine... (i double confirmed, that it has runtime mesh and material used)

    I have no idea why that's the case, but i think it should be fine to remove it, when its not needed anymore. At least it should show some warnings/errors if that's really forbidden.
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Removing RenderMeshArray should be supported, but it seems we have a bug and entities without one are not handled correctly.

    We will fix the bug, but in the meantime you can either place any RenderMeshArray on the entities, or I can provide you with a one line local code change that should hopefully fix the problem.
     
    StefanWo likes this.
  3. StefanWo

    StefanWo

    Joined:
    May 24, 2015
    Posts:
    122
    Yeah, i anyway copied the graphics package for debugging purpose and to remove the SkinnedMeshBaker, due to i handle the deform by myself at the moment. Can you provide that change, than i can try it out here :)