Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Changing Editor scripts is so slow.

Discussion in '2023.2 Beta' started by SpookyCat, Apr 29, 2023.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,790
    Been doing some editor scripts in 2023.2 Alpha and its so painful. In previous versions of Unity you change a line in a editor script switch back to Unity and a second later the script is compiled and you can see the change, but now its change a single line in a simple editor script, switch back to Unity and 20 to 30 seconds later Unity has finished compiling the script, after reloading the domain, completing domain (takes most of the time), loading back end, repainting everything. Is there some option I can set so only the editor script that is changed gets compiled instead of having to rebuild everything?
     
    laurentlavigne likes this.
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,473
    Log a bug. If this is confirmed then the devs will fix it because iteration time regression is on the red list.
     
  3. aras-p

    aras-p

    Joined:
    Feb 17, 2022
    Posts:
    75
    Most cases of "recompiling scripts is slow" that I've seen are because there's something else in the project that does "a bunch of work" whenever scripts are recompiled. Editor Iteration Profiler (https://github.com/Unity-Technologies/com.unity.editoriterationprofiler) typically can show where that script recompile & domain reload time goes. Often points to surprising places.
     
    mahdi_jeddi and LeonhardP like this.
  4. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    141
    Think this was broken in 2020 and 2021 also. In 2019 editor scripts were fast.
     
    sandbaydev and newguy123 like this.
  5. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,790
    There are hardly any scripts in the project so doubt it is that.
     
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,473
    You'd be surprised: tons of things that used to be in the c++ core were moved to c# and slow things down. Really what Aras recommend and what I recommend are the best course of action because this isn't supposed to get worse.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    12,015
    Huh? Yes it is. As has been stated multiple times, as more and more code gets moved to C# there is increasingly more stuff that need to be recompiled and assemblies to be reloaded and stuff to be done, so Unity will keep getting worse in this area with each yearly release.
     
  8. icauroboros

    icauroboros

    Joined:
    Apr 30, 2021
    Posts:
    177
    400ms for just repainting toolbar? Is that a normal thing? total iteration time 12 second and deep profile not enabled. p.png
    is 400ms just for this or there is another "toolbar"?
    toolbar.png

    EDIT: Looks like its not special to 23.2
     
    Last edited: May 2, 2023
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,937
    I just finished trying my current work project and a blank project in alpha 12. Entering play mode took 3 seconds, exiting play mode took 300 milliseconds, and script compilation took 6 seconds. Repainting the toolbar took 100 milliseconds. Project uses URP and is just shy of 21GB (16GB project plus 5GB library).

    Unity 2021.3.15 is the release used for the project. Entering play mode took 2.7 seconds, exiting play mode took 260 milliseconds, and script compilation took 6.5 seconds. Repainting the toolbar took 80 milliseconds.

    I'm happy to see that script compilation is a little faster for the alpha. Meanwhile I couldn't care less about the time to enter and exit play mode as disabling domain reloads causes enter time to drop down to the same few hundred milliseconds as exit time. I almost always keep them disabled if I can.

    My work project isn't taking advantage of anything that could improve performance either like asmdefs. If I took the time to set them up I'd see a significant performance increase as an empty project compiles scripts in half the time.
     
    Last edited: May 2, 2023
    icauroboros and Lurking-Ninja like this.
  10. icauroboros

    icauroboros

    Joined:
    Apr 30, 2021
    Posts:
    177
    So it is normal if you don't compare it to 2019.4 :D

    Empty Project except editor profiler package, all packages removed. Built-in packages not disabled. empty scene, same layout same panels, same backend.

    2019.4 total 3408ms
    19.4.png

    23.2 (probably same on 22 and 21 too) total 5060ms 23.2.png


    What kind of fancy things added to ui repainting since 19.4 that makes it %100 slower ?

    So arguments about "editor is slower because we added tons of functionality on c# side" not telling full story after all since there is 50 percent more iteration time with empty project.
     
    mahdi_jeddi and sandbaydev like this.
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,937
    My company needs features not higher editor performance. :p