Search Unity

BuildPipelineInterfaces causes streaming hickups (>5.6)

Discussion in 'Editor & General Support' started by pvloon, Jul 22, 2017.

  1. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Hi,

    The new BuildPipelineInterfaces is a lot neater than the old attribute way, and I do really like it. However, recently after upgrading to 5.6 I was investigating scene loading performance in the editor and came across this:


    In this scene a lot of neighboring scenes are streamed in. The spikes (>200ms) come from BuildPipelineInterfaces.InitializeBuildMethods. For _every_ scene that is loaded this is called again. This method scans all unitys & your assemblies and uses reflection to find the right build interfaces - meaning the larger our project gets the worse this will be.

    This makes games with level streaming in editor really laggy and hard to play. It's sucks to have all of these well oiled systems working together to create a smooth streaming experience, but then only to have all that undermined because the build team didn't optimise their callback system.

    The biggest problem is that InitializeBuildCallbacks is called for every scene while really it seems like it should only happen in the first scene. I've reported a bug (case nr 933800)

    If I can go on a somewhat larger rant here though, this way of handling callbacks has always frustrated me. Take a look at profiles like these:



    The marks indicate systems doing the same type of reflection over your code looking for attributes. This I believe is an important cause why unity performance degrades for larger projects. This attribute scanning happens every time you enter play mode and every time you recompile code. Actions users perform many many, upwards of hundreds, times a day (Relevant XKCD). It sucks more and more the larger projects get, and especially now that more of the engine is being moved to C# this won't scale. In an ideal world these callbacks would be cached in the AssetDatabase and updated incrementally. Also having some kind of shared UnityReflectionManager that all the subsystems could talk to could help.

    All in all, I really hope something can be done about BuildPipelineInterfaces urgently, and longer term it;d be really great if something was done about this way of handling these types callbacks generally.

    Best regards,
    Arthur
     
    Last edited: Jul 22, 2017
    ping229, Peter77 and hippocoder like this.
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    pvloon likes this.
  3. Mariusj

    Mariusj

    Unity Technologies

    Joined:
    Oct 27, 2016
    Posts:
    8
    This problem was fixed in 2017.2.0p1 and 20117.1.2p2. The fix will appear later in 2017.3.
     
  4. Krillbite-Studio

    Krillbite-Studio

    Joined:
    Feb 25, 2013
    Posts:
    5
    Can we expect a fix for this in in 5.6.4p2 ?
     
  5. Krillbite-Studio

    Krillbite-Studio

    Joined:
    Feb 25, 2013
    Posts:
    5
    Can we get a fix for this in 5.6 soon?
     
  6. ofusion

    ofusion

    Joined:
    Dec 5, 2013
    Posts:
    27
    Can we get a fix for this in 5.6 ? Cause we don't want to upgrade to 2017 for now
     
  7. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Fix for 5.6.6 would be appropriate (If not already done!). The version 5 was really pain to use until 5.3.3, and now it is again a pain with 30 sec. start/play time. I have 6500 GameObects in my scene, disabled all not necessary GameObjects by splitting them in a scene and unload that scene. My scene should start now in 5 sec. I or we don't asking for features for the version 5.6.6, but at least for a 'working' version. I don't know how to develop the game with 30s iteration.

    Has anyone experience comparing the play start time in Unity 5.6.6 and later versions? I don't need anything from the later versions, but speed.

    Is it enough to drop all the code outside the Standard Assets folder to the Plugins folder to get rid of reloading the assemblies?
     
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There's no more patches coming. Unity's 12 month commitment to patches for 5.6 ran out several months ago. 5.6.6 was the final 5.x release.
     
    Peter77 likes this.