# Incremental script compilation

**URL:** <https://discussions.unity.com/t/incremental-script-compilation/820499>\
**Category:** C# & .NET\
**Tags:** Official, 2021.1-beta\
**Created:** [December 14, 2020, 8:19am UTC](https://discussions.unity.com/t/incremental-script-compilation/820499 "2020-12-14T08:19:06Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![amisner2k](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/amisner2k/32/576927_2.png) [@amisner2k](https://discussions.unity.com/u/amisner2k)\
**Post date:** [February 25, 2021, 9:25pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/21 "2021-02-25T21:25:48Z")

</div>

If it’s true that the domain reloading is only necessary to reflect changes to exposed script variables in the inspector or editor windows, then an idea would be to provide a sort of “Refresh” or “Reload Domain” button that’s easily visible and pronounced, that when clicked, Reloads the Domain (make it show a slick animating progress popup modal right away and dim the editor behind it)… That way (hopefully) coders can make quick simple script changes, hit Play, and see results without needing to reload the domain.

If you _do_ make a script change that affects an exposed or serialized variable, then you can reload the domain when you want to instead of being always forced to wait.

Obviously still not ideal, especially for new users learning Unity who won’t know that they have to click “Reload Domain” in order to see the new property they want to show up in the inspector, but…if this could be provided as an advanced option (since it’s for advanced users) I feel this could go at least some way towards speeding up the iteration process.

---

<div class="post-metadata">

**Author:** ![jdtec](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jdtec/32/365040_2.png) [@jdtec](https://discussions.unity.com/u/jdtec)\
**Post date:** [February 25, 2021, 10:01pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/22 "2021-02-25T22:01:03Z")

</div>

Yep I like the idea @amisner2k suggests.

~98% of my DOTs based coding has nothing to do with inspector/editor script values nowadays anyways.

---

<div class="post-metadata">

**Author:** ![JohnPontoco](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/johnpontoco/32/163059_2.png) [@JohnPontoco](https://discussions.unity.com/u/JohnPontoco)\
**Post date:** [March 20, 2021, 6:19pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/23 "2021-03-20T18:19:10Z")

</div>

Does this mean it would be possible to avoid recompiling if the C# doesn’t affect the generated IL? ie. The file change is whitespace only?

---

<div class="post-metadata">

**Author:** ![anon7558213](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@anon7558213](https://discussions.unity.com/u/anon7558213)\
**Post date:** [May 26, 2021, 6:00pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/24 "2021-05-26T18:00:20Z")

</div>

Hi

These changes ruined my Jenkins build flow.

Switching the editor platform causes script recompilation and (unlike Unity 2019) it doesn’t wait until the compilation end but continue to go down via function. Right after the platform switch, I have Addressable build (called when editorPlatformSwitched event is fired) and it always fails because Editor.isCompiling is true.

I can’t use semaphores, because this causes deadlock because Unity is still semi-async. I can’t just subscribe to assemblyCompilationFinished event, because the function ends before this event will be fired.

What do I suppose to do, @jonas-echterhoff_1 ?

My code:

 ![7178890--860668--upload_2021-5-26_20-0-16.png](https://europe1.discourse-cdn.com/unity/original/4X/5/9/8/5985f1c1718ab125704b50b1fee5cafbce63fd57.png)

---

<div class="post-metadata">

**Author:** ![stonstad](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/stonstad/32/610462_2.png) [@stonstad](https://discussions.unity.com/u/stonstad)\
**Post date:** [August 24, 2021, 4:09pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/25 "2021-08-24T16:09:26Z")

</div>

> [@jonas-echterhoff\_1](#):
>
> You can use this thread to discuss this change or report any issues with it.

This change causes a very painful performance regression across a wide range of projects, both simple and complex. I’m seeing on average 15 second delays every time a minor script change is made.

_15s of waiting because I added a carriage return to a game script._  
 ![](https://i.imgur.com/taC7Esa.png)

It raises questions concerning Unity’s internal QA process and how such a huge hit to productivity was introduced into the product. Does Unity test releases with commercial grade solutions of sufficient complexity?

More concerning is that there has been no public acknowledgement that this issue is serious and that it is being given proper attention. Maybe it is being worked on and we will learn the outcome in this thread.

I appreciate Unity. And I appreciate the effort of Unity employees, including @jonas-echterhoff_1 . But I don’t appreciate that this serious performance regression has been known since December 2020 and eight months later it still exists with no discussed timeline for resolution.

---

<div class="post-metadata">

**Author:** ![mahdi\_jeddi](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/mahdi_jeddi/32/85079_2.png) [@mahdi\_jeddi](https://discussions.unity.com/u/mahdi_jeddi)\
**Post date:** [August 24, 2021, 5:19pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/26 "2021-08-24T17:19:09Z")

</div>

> [@stonstad](#):
>
> _15s of waiting because I added a carriage return to a game script._

For us it gets worse as I keep Unity open for more time, up to minutes of waiting. So I just restart the editor every few hours to make the script recompilation faster.

---

<div class="post-metadata">

**Author:** ![FernandoMK](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/fernandomk/32/974269_2.png) [@FernandoMK](https://discussions.unity.com/u/FernandoMK)\
**Post date:** [August 24, 2021, 5:38pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/27 "2021-08-24T17:38:48Z")

</div>

> [@stonstad](#):
>
> This change causes a very painful performance regression across a wide range of projects, both simple and complex. I’m seeing on average 15 second delays every time a minor script change is made.
> 
> _15s of waiting because I added a carriage return to a game script._
> 
> It raises questions concerning Unity’s internal QA process and how such a huge hit to productivity was introduced into the product. Does Unity test releases with commercial grade solutions of sufficient complexity?
> 
> More concerning is that there has been no public acknowledgement that this issue is serious and that it is being given proper attention. Maybe it is being worked on and we will learn the outcome in this thread.
> 
> I appreciate Unity. And I appreciate the effort of Unity employees, including @jonas-echterhoff_1 . But I don’t appreciate that this serious performance regression has been known since December 2020 and eight months later it still exists with no discussed timeline for resolution.

The unity team is gathering feedback in this thread.

[https://discussions.unity.com/t/847630](https://discussions.unity.com/t/847630)

This is a known problem that is affected by several reasons, some are fixed, some are not.

---

<div class="post-metadata">

**Author:** ![stonstad](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/stonstad/32/610462_2.png) [@stonstad](https://discussions.unity.com/u/stonstad)\
**Post date:** [August 24, 2021, 6:01pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/28 "2021-08-24T18:01:34Z")

</div>

I don’t think it’s the same issue. There are no unresponsive stalls here – the Unity editor assembly load/recompilation process was rewritten and it consequently takes longer in Unity 2020.2 and 2021.x.

---

<div class="post-metadata">

**Author:** ![BigRedGames](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/bigredgames/32/120149_2.png) [@BigRedGames](https://discussions.unity.com/u/BigRedGames)\
**Post date:** [June 20, 2022, 8:31pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/29 "2022-06-20T20:31:08Z")

</div>

Hi @jonas-echterhoff_1 , I migrated recently from 2019 lts to 2021lts editor, but now I’m having this issue on Android builds, where the build freezes at a random file, during the CopyFiles step of the Incremental Build. I tried to change the folder’s permissions, reinstall everything, but it is still happening every time.

---

<div class="post-metadata">

**Author:** ![anon7558213](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@anon7558213](https://discussions.unity.com/u/anon7558213)\
**Post date:** [June 22, 2022, 8:36am UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/30 "2022-06-22T08:36:38Z")

</div>

> [@BigRedGames](#):
>
> Hi @jonas-echterhoff_1 , I migrated recently from 2019 lts to 2021lts editor, but now I’m having this issue on Android builds, where the build freezes at a random file, during the CopyFiles step of the Incremental Build. I tried to change the folder’s permissions, reinstall everything, but it is still happening every time.

Hi, is it freeze on operation something like “Copy from Library/Android to something blablabla”? If yes, I have the same problem with the 2021 version: near the end of the build process, it’s like “stuck” for no reason.

However, after waiting for around 30 minutes (on a computer with Ryzen 7 3800X, 32GB of RAM, and Samsung 980 Pro SSD and for the **empty** URP project), the process completes with success and the build worked as expected. For the next builds, this problem does not exist anymore.

Likely this is a problem with the incremental build system.

---

<div class="post-metadata">

**Author:** ![M-Ansley](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/m-ansley/32/510630_2.png) [@M-Ansley](https://discussions.unity.com/u/M-Ansley)\
**Post date:** [November 9, 2022, 6:22pm UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/31 "2022-11-09T18:22:37Z")

</div>

Hi there, we recently upgraded our Unity project from version 2020.3.36f1 to version 2021.3.11f1, and one of the things we’ve found recently is that the build.log file looks significantly different from how it used to. Namely, after an “Assembly Updater Post Process Assets” line in the logs, we used to get information about each of these .dll files compiling:

 ![8574470--1148255--upload_2022-11-9_17-59-1.png](https://europe1.discourse-cdn.com/unity/original/4X/6/9/7/6978389bd3b3e79e797514392efea92ccfdbcb43.png)

These would then appear for us over in GitLab in our CI/CD pipeline console (which uses fastlane and [a u3d plugin](https://github.com/DragonBox/u3d)) in a format that would let us quickly and easily identify compilation errors:

 ![8574470--1148264--upload_2022-11-9_18-4-42.png](https://europe1.discourse-cdn.com/unity/original/3X/4/3/4353256f6c357739de5d74c4f32894c71ec92f36.png)

Since upgrading, we no longer get these file-by-file compilation logs in the console, and while we initially thought this was due to the fastlane plugin we’re using we took a look at the build.log file and it appears these aren’t getting logged in the raw output either (or, if they are, they’re in a different format):

 ![8574470--1148267--upload_2022-11-9_18-8-35.png](https://europe1.discourse-cdn.com/unity/original/4X/4/d/0/4d0ecde73e8ca7449a0915c5a127d3eff268c28d.png)

As a result, we’re currently in a state where, if there are compilation errors, these don’t appear for us in our CI/CD pipeline and we instead need to grab the raw ouput/build.log file to search for errors manually.

What we’re currently hoping to find out is whether the changes to the log files and standard output during builds is due to these changes to the script compilation pipeline, due to some other change, or whether we’ve most likely got some quirk in our project’s setup. If the former, we can perhaps look into adjusting our CI/CD pipeline to accommodate these changes.

Many thanks for any help or advice anyone can offer with this.

---

<div class="post-metadata">

**Author:** ![pistoleta](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/pistoleta/32/188288_2.png) [@pistoleta](https://discussions.unity.com/u/pistoleta)\
**Post date:** [June 2, 2023, 10:15am UTC](https://discussions.unity.com/t/incremental-script-compilation/820499/32 "2023-06-02T10:15:38Z")

</div>

@jonas-echterhoff_1 is ithis still working on Unity 2022.3.0 ? because our android I2LCPP build times are being EXTREMELY slow (30-40 min) and with the same machine iOS I2LCPP builds take less than 5 min…  
Whats going on?

[Previous page](https://discussions.unity.com/t/incremental-script-compilation/820499.md?page=1)
