Search Unity

ECS/DOTS and Static GameObjects

Discussion in 'Entity Component System' started by imaxs, Apr 1, 2021.

  1. imaxs

    imaxs

    Joined:
    Oct 31, 2020
    Posts:
    14
    Hi everyone!
    I face with strange mesh behavior when using static objects, some meshes are disappear.
    In Blender I created 2 cubes and each one has its own material applied.
    Blender_Cubes.png
    I also applied all transforms, then export it to the single .fbx file.

    The FBX Model Import Settings:
    Mesh Import Settings.png

    In the inspector I added the Convert To Entity and Static Optimize Entity components. Note that the Static checkbox in the editor is disabled (I'll enable it later and show you what happens):
    Gameobject Inspector Non-static.png

    So I run this and it looks fine.
    Entities Inspector at runtime.png
    RenderMesh fields contain Cube_01 and Cube_02 meshes.

    Let's enable the Static in the editor and run...
    Entities Inspector at runtime (Static).png
    Now the second cube is lost somewhere... The RenderMesh fields have no previous values, they contain a Combined Mesh.

    Why is this happening? How can I use static objects correctly with ECS / DOTS?

    I'm using Unity 2020.3.0f1 with the URP 10.3.2, Entities 0.17.0-preview.41, Hybrid Renderer 0.11.0-preview.42.
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    If you have SRP batcher enabled, then you shouldn't tick Static checkbox on GO.
     
  3. imaxs

    imaxs

    Joined:
    Oct 31, 2020
    Posts:
    14
    Thank you for your reply! I turned off SRP batcher but it didn't help...

    Something tells me that the problem is in the Combine Mesh... or Convert To Entity doesn't work correctly

    I just set Transform values for each cube
    TransformChanged.png

    Result.png

    Now I see 2 cubes.
    (Since the SRP batcher doesn't affect anything, I turned it on)

    Can someone have a suggestion?
     

    Attached Files:

  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    Ah, do you have static batching in project settings enabled too? For hybrid rendered you should untick it. Always. I remember @Tim-C told me about that half of a year ago :)
     
  5. imaxs

    imaxs

    Joined:
    Oct 31, 2020
    Posts:
    14
    Okay I get it now

    Thank you once again