Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Slow compilation and start in Editor

Discussion in 'Editor & General Support' started by deLord, Jul 27, 2020.

  1. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Hey guys

    This problem really bugs me for many years now. When I watch Youtube videos of people compiling code in Unity and then starting it, there is hardly any delay. However when I just change a single line of code, save and then want to start, it takes roughly the following times:
    • 10s until the Editor is refreshed and I can potentially hit the Play button
    • 9-12s from clicking the Play button until the app actually starts (it's rather small)
    • 3s when I stop the game by hitting the Play button again
    That's 20s everytime I change a single line of code and want to check the results. That's just not cool :) Build and Run on my phone: 3min (30MB apk, building takes~2min)
    From my feeling, this got worse as I installed newer and newer versions. Right now, I am using 2018.3.3f1. And no, problems are not always fixed by installing new versions ;) I had this issue for older versions, too.
    Although my system is 10 years old, it's still good hardware (8 cores, 16GB RAM, gaming GPU).

    Can someone tell me how to improve compilation and start/stop times or why this problem exists?
     
    Last edited: Jul 27, 2020
    JesseSTG likes this.
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,944
    Do you have a solid state drive or spinning disk?
     
  3. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
  4. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    How long does it takes for others to compile/start/end?
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    10 year old 8 core CPU? Really? When you say 10 year old computer, I'm suspicious that the issue is hardware still.

    But the amount of time these operations take depends on the size and complexity of your project, as well as the currently opened scene. My understanding is when you hit Play it takes all currently opened scenes and saves them all to disk in temp files. If they are big that will take longer, if your computer is slow that will take longer. When you exit Play mode Unity throws out the open scenes and restores the scenes from the previously saved temp files. This is why when you make changes to the scene in Play mode the changes are reverted when you exit Play mode.

    As far as when you save a code change and go back to Unity, that triggers a recompile. How long a recompile takes depends again on your project and your hardware. I believe the compile process is fairly single threaded, so poor single thread performance will impact how long it takes. I can't imagine a decade old CPU having good single core performance, as 8 cores was a high core count at the time and typically CPU's with high core counts actually have lower clock speeds than their lower core count variants, making single core performance a weakness. (as an example, look at specs for Xeon CPU's vs desktop in the same generation, you will see significantly lower clock speeds on the Xeons)

    Memory speed was significantly slower a decade ago, which probably has an impact on this as well.
     
    Last edited: Jul 29, 2020
  6. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    "at that time"??? Is it not a lot still?
    I fully agree to all you are saying and had the same thoughts. But my project is small and there are no complex issues to be done or big scenes/assets to be loaded.

    If it was GPU related, I could play around with my GPU Tweak, but I assume same as you that this is a single-thread bottleneck problem.

    How long does it take for you on small projects?
     
  7. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    Also, why does it take like 10s to update a 2048x2048 image because a new version was created on the filesystem???
    Or if I change the sprites in Sprite mode multiple - how can this possibly take longer than 0,1s?
    Deleted a script file. 20s later, I can finally work on...
     
    Last edited: Aug 15, 2020
  8. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    hoping to get an answer from the Unity team
    or anyone... just how long does it take your computers
     
  9. InsaneStudio

    InsaneStudio

    Joined:
    Jan 1, 2016
    Posts:
    4
    Hey buddy it's been sometime now you got any luck with this issue ?
     
  10. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    nope. Didn't get better with 2019.4 either