Search Unity

Miserable performance when translating an element with many children

Discussion in 'UI Toolkit' started by ShadyMike, Jun 25, 2019.

  1. ShadyMike

    ShadyMike

    Joined:
    Apr 14, 2013
    Posts:
    60
    Hey there!

    My Behaviour Tree Editor allows for panning the view by translating the parent element of all nodes. This works perfectly fine, but when there are around 100 nodes, translating the parent element results in a lot of stutter and low framerate in the editor window.

    I am wondering whether or not this is normal, and if there is a different approach I could use that is more performant.

    Thanks in advance.
     
  2. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Hello,

    For this case we recommend using the
    VisualElement.transform.position
    property where you can translate a container and all of its hierarchy without any layout recalculations.

    In 2019.3+ something that can dramatically help is using
    VisualElement.usageHints
    which will trigger some optimization in the rendering (see API), specifically "GroupTransform". In the editor this should work on all platforms.

    In 2019.1 and 2019.2 some of this functionality was internal to support our graph products. It might possible to get some benefits by using GraphView's
    Node
    class until 2019.3 is released.
     
  3. antoine-unity

    antoine-unity

    Unity Technologies

    Joined:
    Sep 10, 2015
    Posts:
    780
    Also, any information about the Unity version you are using, your configuration, profiler data, etc. might help.