Search Unity

What causes compile times to increase depending on what you have in your scene?

Discussion in 'Editor & General Support' started by Enzign, Sep 28, 2016.

  1. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    So the compile proccess seems to be split up into two steps. First when the little wheel in the bottom right corner is rotating (probably the actual compile) and then when unity is frozen and the little wheel is just standing still. For us the compile time of the project is about 70 seconds. But if i delete a certain object in the hierarchy it goes down to 25 seconds. And these 45 seconds are cut on the second part of the compile process. The object i delete does contain quite a large hierarchy, but it's not more than half of my objects in the scene. So the question is what is it in game objects that causes this huge extra time for compiling?
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Unity has to compile all the scene data and all the referenced assets into the corresponding build format.
    I would think that assets do more contribute to a long build time but your example shows that complex object structures can cause a bit of a hassle too.
     
  3. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
  4. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    Thank you guys for helping out. So if Unity compiles all scene data on every compile, that would mean that the build time would correlate to the size of the scene file. Which seems very likely in my case. Removing this particular object with all it's children recuces the file size of the scene file with roughly 70% which would be about the same as the compile time gain.

    It doesn't seem like the profiler profiles what's going on during the part of compilation when Unity is locked. So i didn't get much information there. Unless you need to do something for it to capture the whole frame no matter how long it is. Maybe then it would show something.