Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Resolved Slow Rendering Performance with only 100k Entities

Discussion in 'DOTS Graphics' started by Studiomaurer, Apr 9, 2021.

  1. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    52
    I've set up a system that Spawns 100k Entitiy Tiles in a Grid.
    That part is working pretty smooth, in the playerloop however the "LocalToParentSystem:UpdateHierarchy" is taking 80-90ms every frame even though nothing is happening in the scene.

    Performance should be much better... this is my first DOTS Project and I probably missed something really basic. Can anybody tell me what htis System does and how I can speed the process up? Otherwise I'm in serious trouble: When everything is done there will be 4 to 5 Million objects in the scene (static most of the time).

    Using Unity 2020.3.2f1, Entities 0.17, Hybrid Renderer 0.11 combined with URP 10.4.0 (hoping this would be most performant)

    Any hint is appreciated.

    Best,
    -martin
     
    apkdev likes this.
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,736
    If they share same parent - unparent them. Or avoid parenting completely (which is fastest);

    Transforms which are attached to same root cannot be processed in parallel by Unity, hence why you're seeing stalls.
     
    Haneferd likes this.
  3. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,331
    Did you mark static tiles as StaticOptimizeEntity component on prefab (if they're converted from GO) or added Static component to entities (if you create them from code)?
     
    Haneferd and calabi like this.
  4. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    52
    @xVergilx : I didn't use parenting that I were aware of. My "Prefab" Entities were organized in a Tidy Container in a Subscene so they would be preprocessed. Just to be sure that the copies wouldn't inherit any parenting I took them out of the Subscene to the root, but this didn't make any difference.

    @eizenhorn: Ah, ok.. here goes the obvious thing I missed, thank you. Player loop is down to 5ms. Editor loop still over 40ms running culling jobs but I guess there is nothing you can do about that. I had to add the Static component after Instantiation and Resetting the Position in order to avoid errors. This will be a city builder game, so just a few of thes tiles will updated once in a while. So the most performant approach would be to remove the static component, edit, and reapply the static component. Right?

    Thank you both for the quick reply.
     
    Haneferd and xVergilx like this.
unityunity