Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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:
    132
    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:
    352
    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:
    132
    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 :)