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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    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

Official Improving iteration time on C# script changes

Discussion in 'Scripting' started by xoofx, Oct 18, 2021.

  1. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    205
    Yeah, my bad. 2019 used v2, i just had it set to v1. Latest 2020 showing good compile times. Esp, when uninstalling not used packages(rider, version control etc) and upgrading the latest visual studio pack.

    so its pretty much „just“ 2021/2022 that’s behaving bad
     
  2. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    125
    i have fix something like this ...

    i check all the editor window class. and add OnDisable() {} to make sure all scriptobject load to set null or use Editor.DestroyImmediate()
    after all this use the EditorUtility.UnloadUnusedAssetsImmediate() to gc.

    hope this help you.
     
  3. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    205
    Not sure if i understand this right. How is this improving the c# compile times?
     
  4. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    125
    you should delete & gc all your asset in editor class when OnDisable
     
  5. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    205
    I am still confused. On disable never gets called when i compile a script

    Do you have an example script or project that shows what you are doing?
     
  6. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    125




    some things like this. after i have done this modify of editor class...
     
  7. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    Hi @xoofx. It has been 80 days since we last heard anything. Just wondering what the status is for this critical issue.
     
  8. paulrumyancev

    paulrumyancev

    Joined:
    May 4, 2021
    Posts:
    4
    My scenario even worse - Reload Script Assemblies pops up every time I enter Play mode in the editor.
    And it happens without even making any changes to C# scripts.

    (Project Settings > Editor > Enter Play Mode Settings > Domain Reload is Off)

    So to me it seems like the issue is not 100% related to compilation times after some of the scripts were modified. I created separate thread.

    https://forum.unity.com/threads/rel...pon-every-play-stop-in-empty-project.1221063/
     
    Last edited: Jan 6, 2022
  9. IcyPoint

    IcyPoint

    Joined:
    Feb 25, 2020
    Posts:
    3
    For me, it get worse while VS debugger attached.
     
  10. TimHeijden2

    TimHeijden2

    Joined:
    Aug 11, 2016
    Posts:
    77
    I'm also having trouble with very long domain reload times, but I feel like there is something more going on in my instance. Specifically the CreateAndSetChildDomain (unload domain) is taking a very long time for me. I've waited with digging deeper until now because I just started looking into upgrading from 2020.3 to 2021.2. In the new version, it seems like assembly reloads either occur more often, or at least the problem is much more consistent. I simply need to reimport a script in the root Assets folder, at which point I need to wait 1-2 minutes for the reload:
    I've tried turning on "EnableDomainReloadTimings" in the diagnostics preferences, but unfortunately this specific item doesn't provide any more information. I've also tried deep profiling + editor iteration profiler, which after crashing my pc or unity 3x (over 28GB mem usage o_O ) gave me almost nothing, other than noting the time was mostly part of unloading the unity domain.

    Currently trying to figure out what could be causing the domain to be so large (or difficult to unload) but not sure how to go about doing that. There is one plugin in my project that once removed seems to "resolve" the issue, but that could also just be a ghost I'm chasing. Diving deeper into that now, will update if I find anything.

    edit: I've found the root cause of my specific issue, and it was related to the plugin I mentioned containing a MonoBehaviour with a constructor & destructor, and using that monobehaviour in over 80000+ objects in scenes/prefabs, triggering code whenever unity would reload its domain even if in an empty scene. Was able to work around it so its not nearly this bad ^^
     
    Last edited: Jan 11, 2022
  11. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    I logged into FogBugz to check on the status of the asset refresh bug I submitted (1376641) with supporting screenshots and editor iteration data. The associated data shows AssetDatabase.Refresh and Application.UpdateScene occurring twice per editor iteration, which effectively doubles the time it takes before the editor is usable.

    My report was submitted over 75 days ago and there has been no response. Similarly, there have been no new updates to this forum thread in nearly three months. I'm not sure who to page at Unity.
    @xoofx or @lyndon_unity @JoshPeterson What's going on with editor iteration performance? Is there quantitative progress you can share?
     
    spvn, NWHCoding, Ksanone and 4 others like this.
  12. IcyPoint

    IcyPoint

    Joined:
    Feb 25, 2020
    Posts:
    3
    And there is not any unity release after 2021.2.7 released for a month.
     
  13. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    2,849
  14. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    123
    It was holiday season, what did you expect?
     
    ontrigger, Lurking-Ninja and EagleG like this.
  15. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    161
    2021.2.8f1 just came out and it doesn't solve any issue so after a month we are still in the same boat :/
     
  16. josiahms_unity

    josiahms_unity

    Joined:
    Jul 23, 2018
    Posts:
    2
    +1 to this whole thread as I've resorted to doing any sort of scripting prototyping in 2018.4.36 simply because it's quick. This is a really poor workaround as eventually I have to make edits to my projects in the 2021.2.5 build and those are taking 20 seconds or more from saving a script edit to getting into play mode due to the time it takes to reload script assemblies. It's just impossible to stay in any sort of cognitive flow with that much of a wait time.
     
    Ksanone, ontrigger and RobertOne like this.
  17. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    92
    My 5900x died and took windows with it, picked up a 12900kf and samsung 980 pro. I went from 15-20 second recompile and script reload to 5 seconds max on my new machine. Fingers crossed it stays this way :D

    2021.2.6
     
  18. Maria_Angelova

    Maria_Angelova

    Unity Technologies

    Joined:
    Mar 3, 2020
    Posts:
    18
    Hello,

    This is an update about our efforts internally to improve iteration time during development.

    As we previously wrote, the regressions seen in 2020.3, 2021.2 and 2022.1 do not have a single root cause, but are a result of many c
    hanges we made which have negative impact. In this post, you can see a list of descriptions of optimizations we are working on and have completed since the last update, as well as a performance comparison of different unity versions for a basic 3D template project.

    Our iteration time task force has been busy with identifying and implementing performance improvements
    We continue the cross-team effort to improve performance monitoring and identify opportunities to optimize everything happening during Script compilation, Domain reload, Enter playmode and Asset importing.

    Here are the improvements positively impacting these areas for the upcoming public releases of 2020.3 and later versions:
    • Removed duplicate SceneUpdate call when entering playmode
    • Jobified/optimized particle system prewarm
    • TerrainTools initialization cost when entering play mode reduced
    • Optimized saving a scene with very large numbers of game objects
    • Optimized performance of FindRuntimeScript/FindEditorScript improving domain reload
    • Speed up scene backup code when entering play mode
    • Static Batching Sorting cost cut dramatically
    • Visual Studio support package version 2.0.12 reduced its initialization cost
    • Visual Scripting package version 1.7.4 (and later) eliminates its domain reload cost for users when not using Visual Scripting
    • Preventing saving Scenes when not dirty
    • Optimized package manager dependency graph generation on entering playmode
    • ADB Filehasher improvements, to ensure multithreading is well distributed, brings faster asset importing
    • SerializationFile write optimization improved asset importing performance by upwards of 25%: the larger the asset, the greater the gain
    • Importing small assets (C# Scripts, .txt files and others) is up to 65% faster since 2021.2
    • Serialization command cache improvement for domain reloads and making player builds faster
    Here are the areas where improvements are work in progress:
    • A set of low-hanging fruit optimizations across the scripting pipeline and domain reload
    • TypeCache v2
    • More parallel script compilation
    • Reduced dependencies between ADB and script compilation/domain reload
    • Prevent clearing an ADB cache which keeps track of assets to importers for 63% faster asset categorization on domain reload
    Low-hanging fruit optimizations across the scripting pipeline and domain reload code base
    As we profile Unity we find “low-hanging fruit” - small code changes which result in small but noticeable speed up. These often scale with the size of the project (e.g., the number of MonoScripts, assemblies to load, the number of times a given attribute is used, etc). Identifying, implementing and landing these simple optimizations is an ongoing process, and we aim at backporting these improvements.

    TypeCache v2
    Our existing TypeCache implementation has an unavoidable domain reload cost: the TypeCache has to be rebuilt from scratch. For an empty 3d template project it takes 0.3 seconds and the cost scales with the amount of types in all loaded assemblies.
    We have begun work on a new implementation of the TypeCache, which will allow us to reuse the cached type info and reduce this cost dramatically or completely eliminate it in some use cases (e.g., entering playmode when there are no script changes and no added or updated packages). This is a relatively large piece of work which will be implemented over the next few months in stages.

    Script compilation time
    A team at Unity is working on script compilation time improvements. The compilation pipeline will be better at parallelizing work, thus improving the total time it takes to compile the script assemblies which changed. This is work in progress, we hope to be able to give you stats of the improvement in our next update post.

    Reduced dependencies between ADB and script compilation/domain reload
    On previous version of Unity the flow has always been: Import compilation assets(.cs,.asmdef,.rsp ect.) -> Compile -> Domain reload -> Import all other assets. This behavior came with a big amount of issues, due to extracting information, needed for binding .cs and .dll files with unity objects, is done during asset importing by reading assembly metadata, and parsing C# text. This is error prone and has limitations:
    • Only able to have 1 MonoBehaviour per file
    • File and class has to have same name
    • Issues with Compilation specific code (Defines)
    • Extracting unity objects from .dll's, with references to other .dll's in the project, was depending on import order
    In 2022.2 we are changing the behavior to be: Compile -> Domain reload -> Import. Now we can use the domain to extract all the needed information. That mean we don't spend time on parsing C# or reading assembly metadata so removing dependencies between script compilation and asset importing should help speed up iteration time. In time we can support multiple MonoBehaviour in a single C# file.

    Prevent clearing an ADB cache which keeps track of assets to importers
    Our asset database team discovered another cache which can be reused instead of rebuilt resulting in 63% faster asset categorization during domain reload. Coming in 2022.2.

    3D template project in numbers
    We end this update with a comparison of the time domain reload takes under different circumstances using a 3D template project when opening it with no changes since the last Unity session. All numbers are seconds.


     
    Atrixx, JoNax97, hippocoder and 29 others like this.
  19. Igotlazy

    Igotlazy

    Joined:
    Jan 15, 2018
    Posts:
    31
    Thanks for the thorough update. Are the improvements "for the upcoming public releases of 2020.3" listed in the 2020.3 table? If not, what gains can we expect?
     
  20. RobertOne

    RobertOne

    Joined:
    Feb 5, 2014
    Posts:
    205
    Thanks for the update. Mostly I am worried that in the table 2020.3 might be seen as the ultimate benchmark and how the numbers in 2021/2022 should look like. Personally I would like to see the numbers of 2019LTS since it started to go downhill from there

    script change:
    2020LTS: 2.1s
    2019LTS: 1.6s
    2018LTS: 1.5s

    new script:
    2020LTS: 1.6s
    2019LTS: 1.4s
    2018LTS: 1.3s

    "This is work in progress, we hope to be able to give you stats of the improvement in our next update post." any idea when this will be?
     
    Last edited: Jan 18, 2022
  21. Maria_Angelova

    Maria_Angelova

    Unity Technologies

    Joined:
    Mar 3, 2020
    Posts:
    18
    Hi. Yes, these measurements were taken in the latest available public release version of 2020.3 which includes all the improvements mentioned in the "upcoming" section. In other words, if you update to the latest public version, you will hopefully notice improvement in the iteration times.
     
    Ksanone likes this.
  22. Maria_Angelova

    Maria_Angelova

    Unity Technologies

    Joined:
    Mar 3, 2020
    Posts:
    18
    We'll make sure to include numbers from 2019LTS in the next update.

    - Reduced dependencies between ADB and script compilation/domain reload
    This will unfortunately not be backported. It will be present in 2022.2.

    - A set of low-hanging fruit optimizations across the scripting pipeline and domain reload
    Like mentioned in my update post, we do these continuously and there's a batch of these coming to 2020.3 - 2022.2 during the next month.

    - TypeCache v2
    This is a larger piece of work and there may be a few months until it lands. We are currently unsure if it will be backported or remain a 2022.2 improvement as it is early in development.

    - More parallel script compilation
    It is still work in progress and we have not decided about backports.

    - Prevent clearing an ADB cache which keeps track of assets to importers for 63% faster asset categorization on domain reload
    This has landed to 2022.2, we are currently unsure if we will backport it, but it's likely that we will.
     
  23. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    92
    Pretty sad If the improvements do not make it to the versions most people will be using.
     
    andreyefimov2010 and Thunderik like this.
  24. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    Many thanks, @Maria_Angelova.The quantitative performance comparisons show Unity's commitment to data-driven improvement. It is helpful to know these metrics show new and current versions of 2022 remain slower than 2020. The work that lies ahead for performance optimization is substantial and real. Thank you for your continued efforts.
     
    Maria_Angelova, xoofx and Ksanone like this.
  25. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    Quantifying performance and sharing results is an important next step for the evolution of the editor. I'm very grateful for their commitment. I fully agree that 2019 measurements should be included. The measurement names would likely be different in 2019 due to architectural and asset pipeline changes. For this reason, a measurement of "total editor iteration time" for the 2019 editor and later versions would set the bar for excellence.
     
    PutridEx likes this.
  26. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    Will there be measurements for a project larger than the 3D template? That template doesn't exactly have a large number of scripts or assets. A shipped title on Unity will have several thousand assets and scripts...
     
  27. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    161
    2020.3.26 after importing an asset from the store (Enhanced Scroller):

    upload_2022-1-19_13-38-20.png

    And the symbol of "compiling" is stuck. :')
     
  28. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    2,849
    This isn't really related to this thread? This is about iteration time, not plugins causing Unity to get stuck.
     
  29. Maria_Angelova

    Maria_Angelova

    Unity Technologies

    Joined:
    Mar 3, 2020
    Posts:
    18
    The 3d template is just one of the benchmarks we use internally to quantify the performance and see development over time. Another is the 3d HDRP template which is more scripts heavy. For this update post we decided it's best to use the 3d template as it's the one most users can relate to. Ofc as projects grow in size and complexity (assets, scripts, tools) and as unity itself evolves and adds new tools and features - iteration times grow as well and the reasons can be many. Our main focus currently is optimizing code which affects every project's iteration time, but we do also look into more rarely used code when we discover bad performance use cases.
    Like you said, it takes time and dedication to discover, improve and keep in good shape the performance of various unity features and aspects. Not all improvements we make can be taken to older LTS versions as sometimes they are not applicable and other times the risk of breaking existing projects is too large. But we always consider it.
     
    Anthiese, KamilDA, Ksanone and 2 others like this.
  30. KamilDA

    KamilDA

    Joined:
    May 21, 2020
    Posts:
    278
    @Maria_Angelova, I noticed that the VS package is more actively updated than VS Code.

    Considering the VS Community license that ships with Unity doesn't allow for organisations with more than 5 users to use it - and that VS Code is generally more lightweight...

    Does Unity have plans for at adding relevant optimisations to VS Code too?

    Thank you.
     
  31. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    894
    Maybe we should work on preventing the editor from crashing after making changes to our scripts, rather than investigating a few milliseconds....This bug has been around since 2020.1 and still kicking in 2022.1b5

    Not trying to crash the party, but force closing and reopening a crashed project takes about 5 minutes...if nothing gets corrupt...if I get lucky then I am stuck reimporting the project for about 2 hours. Then I have to inspect key assets to check if serialization didn't get messed up...

    I appreciate the investigative effort...but also when my project crashes about 2~3 times every hour...and much much worse when I am working on scripts all day, I kind of wonder if this needs this much effort...while I am constantly reopening, force closing my project and spending about an hour on average everyday...

    Personally, I get really scared sometimes to save the changes that I made to the script when I haven't closed and reopened my editor for a while, because when the editor crashes, all the changes that I made, unless another scene was loaded, gets lost. So I copy paste the whole script to Notepad+ and cancel save, save the editor and close the editor then reopen editor then copy scripts back to VS then save...this is my current, and most down to earth "iteration".

    I wonder if Unity is even aware that most of its users are fighting the Engine half the time...I honestly hadn't noticed any performance regression as I am mostly praying during compilation...

    Just my 2 cents.
     
    Last edited: Jan 26, 2022
  32. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    146
    While I can relate to all the people fighting with iteration times gone too far, I really can't say I have problems with Unity crashing. I can't even remember when Unity crashed on me last time - maybe 3-4 times per year? And especially during the compilation time, even I work on scripts like 80% of my game dev time. It rather happens in the editor itself.

    So there must be something wrong with your environment when you get so many crashes - either your hardware (corrupt memory maybe) or the 3rd party scripts you have. I don't say Unity shouldn't handle faulty code by itself and prevent crashes but again, that's something you can investigate and fix on your side...

    Do this happen to you even with fresh new projects from their templates?
     
    spvn, cxode and stonstad like this.
  33. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,965
    We have had periods with Unity crashing on the regular. Can't remember all of them, but gut feeling is that about 50% was our fault, and 50% was Unity's fault.

    In all instances it was possible to figure out why it was crashing regularly, and work around it. Sometimes that took a lot of work, but it was doable.

    Unity doesn't "just crash for no reason". Delivering bug reports with the stack trace and being aggressive about giving more info has always solved it.

    Posting "Unity crashes a lot for me, and I think it crashes a lot for everyone, so you should obviously be fixing that" isn't going to get much done.
     
    spvn, JoNax97, Anthiese and 6 others like this.
  34. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    390
    What does the crash section of editor.log tell you? The stack trace of the crash is a good way to identify the cause. If you start a separate thread, since this one is dedicated to iteration performance of the editor, we can try to assist.
     
  35. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    8,752
    I want to join to this choir myself. Unity crashed on me in January, 2021, when the relatively new UI Builder was instable for some reason. Before that, Unity crashed in April of 2020, when I added a not supported (but undocumented) entry to the
    .collabignore
    file. And that's it. Unity takes crashes and crash reports very seriously. You should try to isolate the cause and if it turns out that Unity's fault, let them know.
     
  36. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    2,849
    I have a feeling @jjejj87 is referring to when Unity gets stuck indefinitely recompiling, rather that what you imagine by the term 'crashing'. It did used to happen to me regularly a number of Unity 2020 versions ago, and it was potentially caused by Odin but I don't think anyone found anything reproducible to make that connection. But after a few version updates those freezes have entirely ceased for me.
     
  37. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    894
    The thing is editor works just fine when the project is light. Now my project file is around 300gb and this editor acts like an eggshell now...

    I've sent more than 20+ bug reports, but so far it is apparently not fixed
    So I've given up hope. It will eventually get fixed in a few years. Gonna jump ship next project.
     
  38. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    146
    Is 300gb including the Library folder or just assets? Looking at your forum join date I suppose you're an experienced Unity user. I don't say projects can't go that big in size but are you sure you're using all those assets? Many beginner Unity developers just import assets from the store and don't use 90% of the stuff there, so it's always recommended to import things to temporary project and export just what you need as a package (including dependencies of course). Again, Unity itself should be capable of handling those sizes, but why cluttering the project if you don't need to, everything for sure would be faster with less assets...
     
  39. wheee09

    wheee09

    Joined:
    May 21, 2018
    Posts:
    68
    Hey all,

    Eagerly awaiting the optimizations (next month?). Using 2021.2, and with the Diagnostic switches turned on, I get the following:
    Code (CSharp):
    1.  
    2. Asset Pipeline Refresh: Total: 8.100 seconds - Initiated by RefreshV2(AllowForceSynchronousImport)
    3.         Summary:
    4.                 Imports: total=1 (actual=0, local cache=1, cache server=0)
    5.                 Asset DB Process Time: managed=0 ms, native=413 ms
    6.                 Asset DB Callback time: managed=73 ms, native=9 ms
    7.                 Scripting: domain reloads=1, domain reload time=5722 ms, compile time=1881 ms, other=0 ms
    8.                 Project Asset Count: scripts=8621, non-scripts=4403
    9.                 Asset File Changes: new=0, changed=1, moved=0, deleted=0
    10.                 Scan Filter Count: 1
    11.         InvokeBeforeRefreshCallbacks: 0.177ms
    12.         ApplyChangesToAssetFolders: 0.065ms
    13.         Scan: 159.472ms
    14.         OnSourceAssetsModified: 0.825ms
    15.         InitializeImportedAssetsSnapshot: 25.764ms
    16.         GetAllGuidsForCategorization: 1.810ms
    17.         CategorizeAssets: 148.141ms
    18.         ImportOutOfDateAssets: 7629.724ms (5741.443ms without children)
    19.                 CompileScripts: 1881.188ms
    20.                 ReloadImportedAssets: 1.811ms
    21.                 EnsureUptoDateAssetsAreRegisteredWithGuidPM: 2.997ms
    22.                 InitializingProgressBar: 0.000ms
    23.                 PostProcessAllAssetNotificationsAddChangedAssets: 1.800ms
    24.                 OnDemandSchedulerStart: 0.486ms
    25.         ReloadSourceAssets: 5.924ms
    26.         UnloadImportedAssets: 2.177ms
    27.         PostProcessAllAssets: 75.167ms
    28.         Hotreload: 6.946ms
    29.         GatherAllCurrentPrimaryArtifactRevisions: 0.573ms
    30.         UnloadStreamsBegin: 0.069ms
    31.         LoadedImportedAssetsSnapshotReleaseGCHandles: 2.769ms
    32.         GetLoadedSourceAssetsSnapshot: 4.883ms
    33.         PersistCurrentRevisions: 0.621ms
    34.         UnloadStreamsEnd: 0.069ms
    35.         GenerateScriptTypeHashes: 5.878ms
    36.         Untracked: 110.086ms
    37.  
    I'm simply changing one character in a debug statement and it takes 10-12 seconds (even if it says 8.1 seconds there). Most of the time is in ImportOutOfDateAssets which is taking 7629ms.

    Any workarounds for that or just have to wait?
     
    tamerlanunity and KyleOlsen like this.
  40. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    137
    I am using 2021.1.19f1 and am experiencing reload times of between 30-60 seconds on a brand new Mac M1.
    Unity has become basically unusable for me.
    Perhaps no-one at Unity has realised, but this is a problem.
     
    Last edited: Feb 3, 2022
    tamerlanunity likes this.
  41. josiahms_unity

    josiahms_unity

    Joined:
    Jul 23, 2018
    Posts:
    2
    Thanks for the awesome update! Even if the changes take time and are just small improvements at first I'm happy to see you are taking this seriously and including details on both what you are improving as well as the results so far. Looking forward to your next update!
     
  42. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    @Der_Kevin Something feels rather wrong with that project if those are real times... Even if 2021 trippled the time compared to 2019, that would still have been about 8 minutes back then which still seems crazy. Have you tried re-importing the project once? And I guess you do not use any separated assemblies?

    In every case according to the devs they haven't found a solution that would reduce the time by a magnitude or anything that significant.
     
  43. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,459
    For me reload times begin getting longer and longer until I restart Unity and then it is back to just normal (and relatively slow) for half an hour until it starts again. After 2 hours of working in Unity reload takes ~30 seconds compared to ~3 after restart. And I am using .asmdefs religiously so that should prevent everything from compiling each time.

    Edit: Tried deep profiling and it seems that AssetDatabase.V2 is causing most of the issues and quite a lot of GC (this was one of the shorter reloads, just changing one line of code):

    upload_2022-2-5_23-23-47.png
     
    Last edited: Feb 5, 2022
    joshcamas, IcyPoint and DragonCoder like this.
  44. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    YES, that is something I experience too! Had assumed it was because I'm using an older beta version.
     
    Last edited: Feb 6, 2022
  45. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That was fixed for me in a later version of Unity. I think for me it was scriptableobject-related, where Unity would keep leaking memory and taking progressively longer to enter play mode.
     
    DragonCoder likes this.
  46. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    9,624
    Definitely not my experience.
    It's good that you are improving things within the same major Unity versions, but from major version to major version it seems things are getting significantly slower across the board? This is a worrying trend.
     
  47. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    304
    This speeded up shutdown significantly (instant), not sure about anything else, but I hope so. Although Editor.Log doesn't say much change there.

    Project Settings > Editor

    Default changed to Parallel + 12 threads (hex-core)
    upload_2022-2-6_8-56-40.png upload_2022-2-6_8-55-13.png

    Preferences > Asset Pipeline

    Changed 25% of logical cores to 100% because why not
    upload_2022-2-6_8-58-47.png upload_2022-2-6_8-59-19.png
     
    tamerlanunity and NWHCoding like this.
  48. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,459
    The version is 2021.3.10f1. I am not going to upgrade to 2022 as I was burned once already by the cutting edge release of Unity. Even 2021 is not the most stable but I liked the features.
    Also, I do not have ScriptableObjects in the project.
     
  49. NWHCoding

    NWHCoding

    Joined:
    Jul 12, 2012
    Posts:
    1,459
    Unfortunately seems to do nothing to the AssetDatabase.Refresh times. And that is on 12C/24T processor. My guess is that there is an option for the future changes but not much of the AssetDatabase is parallelized.

    With parallel and 12 threads:
    upload_2022-2-6_13-49-3.png

    Without parallel:
    upload_2022-2-6_13-50-11.png

    Tried a few times with each setting just to get these parallel workers going. Same results.
    In fact, it even seems to be slower when parallel is enabled. Tried it a few times, always changing the exact same constant in the script, and each time Parallel enabled was slower. Interesting.
     
  50. Teemon666

    Teemon666

    Joined:
    Feb 3, 2022
    Posts:
    1
    Im absolutelly noobie for Unity and started up to watch first step manuals and found so every time between code savings and openings Unity - Unity spends about 10 sec (for relatively free project) to "rebuld" his project.... Every chage.. Spends about 10 secs... Look not quite good, especially when you relly noobie and after change some value want to see what changed in the Unity\Play mode - it spends about 30 secs summary.... Hoh, really, really not well...
    What is the solution? I found this topic from Google, what is next steps, watch this thread for updates?
     
    tamerlanunity likes this.