Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Question Long Long Long build times

Discussion in 'VR' started by nsmith1024, Jul 8, 2022.

  1. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    861
    Hello,

    My VR game for Oculus has 20 levels. Right now if i change just 1 line of code or change anything at all, it rebuilds everything taking between 8 to 10 hours.

    Im trying to find ways around this so that i dont spend the rest of my life building this game LOL.

    I thought maybe i would keep one main scene, and convert all the other scenes to be asset bundles that are manually built only if i change something in a particular scene.

    So if i change any code it would only build that one main scene, where that main scene would load in the asset bundles scenes while the game is running.

    Anybody knows if thats a good idea? Or maybe there is an even better way to do it?

    Im also wondering why it keeps re-building everything, including all the thousands of shader variants and all the rest of the stuff that have not changed.

    Thanks
     
  2. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    191
    Try installing the Build Report Inspector from Unity (0.2 preview build, of course, does Unity every finish 90% of the stuff they make?). It will analyze your Editor.log (which you can also do manually) to see where time is being used up the most. If I can venture a guess: you've got a ton of non-SRP/URP shaders which need to be rebuilt entirely (SRP/URP don't since Unity includes the "built" shaders) and/or you have duplicate asset dependencies in multiple scenes, so that every scene needs to rebuild ALL shaders from scratch. I had this problem initially when using Better Lit shaders asset due to multiple scenes re-using the same assets and requiring a 5-6 minute rebuild for every scene, where 95% of the build time per scene was just building the same shaders. Very painful.
     
  3. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    861
    Thanks for the info, but if the shader is already built, why does it have to rebuild it every time? Cant it tell that it was already built similar to what a make file does. Make file checks the time stamp of the source code and the compiled object, if the compiled object is later than the source means it was already compiled, so im wondering why Unity doesnt do that when building. With me is building almost 100K shader variants each time.
     
  4. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    191
    I wish it were that easy... ask Unity why they do it this way.

    I feel your pain, I have spent countless hours/days/headaches debugging absurd build times (though never more than 30 minutes for my little 340MB APK, but it used to be 4 minutes in 2020 versions, yay for upgrading to 'faster' 2021 /s).

    All I can say is that if it is rebuilding multiple times, it's highly likely that you have duplicate bundle redundancies. Did you try the build report tool? Or maybe even better, if you are using Addressables, definitely look at the Addressable Analyze Tool (also preview, untouched since 2019, what a surprise) which will find problems such as duplicate bundle redundancies which will probably be the issue you are seeing. Get rid of those duplicates, and your build times will drop. Guaranteed or your money back (but not your sanity, sorry).
     
unityunity