Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Feedback EditorLoop::SceneHierarchyWindow.Paint performance

Discussion in '2020.1 Beta' started by Peter77, May 9, 2020.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,112
    Unity 2020.1.0b8:
    SceneHierarchyWindow.Paint
    continues to be the #1 performance issue for me while being in play mode. I've attached Profiler screenshots.

    I'm not sure how valuable these screenshots are to you. Please let me know whether they are helpful, because if they are not, what would be helpful to provide so you can improve performance in that area?

    SceneHierarchyWindow.Paint
    deep profile:
    upload_2020-5-9_10-4-33.png

    upload_2020-5-9_10-4-45.png

    SceneHierarchyWindow.Paint
    without deep profile:
    upload_2020-5-9_10-13-4.png
     
    Last edited: May 9, 2020
    richardkettlewell and SugoiDev like this.
  2. Lelepoop

    Lelepoop

    Joined:
    Nov 14, 2016
    Posts:
    126
    I tend to hide the hierarchy contents by collapsing the scene because of this, its a noticeable improvement. Hopefully theres some ms they can shave off the hierarchy creation/rendering logic in the future.
     
    Peter77 likes this.
  3. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    115
    Hi Peter,
    Please grab a screenshot where we can see what allocates the 1.9 KB under DoItemGUI.
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,112
    Hi Mads,

    thanks for your interest!

    TreeViewGUI.DoItemGUI
    :
    upload_2020-5-12_13-13-41.png


    SceneHierarchy.SyncIfNeeded
    (also called every few updates):
    upload_2020-5-12_13-13-33.png
     
  5. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    115
    Ok so those two situations is expected when there has been a structural change to the transform hierarchy. The hierarchy is rebuilding it's view in SyncIfNeeded and lazy initializes and caches the name of each item on the first repaint.
    So it seems like is that something in your game logic is constantly making transform structural changes (re-parenting , sibling order changes or renaming gameobjects).
    I know that we have had an issue with transform.SetAsLastSibling() that would dirty the hierarchy state when called even if the transform is already the last sibling, a fix is coming for that. But you can search for that on your side.
    And we will look into where we can shave time off on our side.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,112
    Hi Mads,

    thanks again for your reply.

    Yep, that's spot on and I guess all of the three examples happen :)

    The game utilizes gameobject pooling for a lot of stuff, objects get acquired from a pool, change their parent and get renamed for debugging purposes, just to name one path where this occurs. While I could get rid of the renaming, I can't get rid of the other points.

    You seem to have an unique approach to investigate performance issues, that I would like to understand. Please excuse me if I ask the obvious.

    My approach would have been to investigate the path where most performance is being spent, that would be
    GameObjectTreeViewGUI.OnContentGUI
    with 4.5ms, but you went straight to
    GameObjectTreeViewItem.get_DisplayName
    which costs 0.25ms.

    Why did you go for the 0.25ms cost rather than the 4.5ms?
     
  7. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    115
    I was commenting on your two screenshots
     
  8. Mads-Nyholm

    Mads-Nyholm

    Unity Technologies

    Joined:
    Aug 19, 2013
    Posts:
    115
    To dig more I need your repro project. If you have submitted a case where you have attached it recently you can just refer to that here.
     
  9. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,185
    @Peter77 was your question here resolved?
     
    Peter77 likes this.
  10. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,112
    I haven't looked into the issue any further. Feel free to consider the case closed.
     
    LeonhardP likes this.
unityunity