Process

Speeding Up IL2CPP Build Times in Unity

IL2CPP builds can eat your afternoon. A handful of Player Settings, a protected build cache, and a smarter daily workflow can turn a long wait into a coffee break.

Vectra Play 6 min read
A developer waiting at a desk while a long progress bar crawls across a laptop screen beside an Android phone

To cut Unity IL2CPP build time, keep the Library folder and its build cache between builds, build one CPU architecture during development, set the C++ Compiler Configuration to Debug for test builds, and exclude your project from antivirus scanning. For quick checks, use Mono or a scripts-only build, and save full IL2CPP release builds for when they matter.

Why IL2CPP builds take so long

IL2CPP converts your compiled C# into C++ and then compiles that C++ with a native toolchain. Two full compile steps, over every assembly in the project, including packages.

That second step is where the time goes. Native compilers are thorough, and a mid-sized mobile project produces a lot of generated C++.

The good news is that most of the slowness comes from settings and habits, not from your code. You can fix most of it in an afternoon.

Check these Player Settings first

Open Edit > Project Settings > Player and look under Other Settings, in the Configuration section.

SettingFor dev buildsFor release buildsEffect on build time
C++ Compiler ConfigurationDebugRelease or MasterDebug compiles fastest
IL2CPP Code GenerationFaster (smaller) buildsFaster runtimeSmaller option generates less code
Target Architectures (Android)ARM64 onlyARMv7 and ARM64 if neededOne architecture halves native work
Managed Stripping LevelLow or MinimalYour release choiceMostly affects size, small time gain

The exact location of the code generation option has moved between Unity versions, so if you do not see it in Player Settings, check the Build Settings window.

Master configuration gives the most optimised output but is slowest to compile. There is no reason to wait for it on a build you only want to test a menu in.

Protect your build cache

IL2CPP and the build pipeline cache their work inside the Library folder. A warm cache means the next build only recompiles what changed.

If you run builds on CI, cache the Library folder between runs. Our post on automated builds for a one-person team shows a setup that does this.

Exclude the project from antivirus

Real-time scanning inspects every file IL2CPP writes, and it writes thousands. On Windows, adding exclusions can make a noticeable difference.

Unity's own documentation suggests excluding the project folder and the Unity install from scanning. Add your project path and the editor folder in Windows Security, under virus and threat protection settings.

Only exclude folders you trust, and keep the rest of your system protected.

Script the dev and release settings

Switching settings by hand is how release builds go out with Debug configuration. Put both profiles in an editor script.

using UnityEditor;
using UnityEditor.Build;

public static class BuildProfiles
{
    [MenuItem("Build/Use Dev IL2CPP Settings")]
    static void Dev()
    {
        var target = NamedBuildTarget.Android;
        PlayerSettings.SetIl2CppCompilerConfiguration(target, Il2CppCompilerConfiguration.Debug);
        PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
    }

    [MenuItem("Build/Use Release IL2CPP Settings")]
    static void Release()
    {
        var target = NamedBuildTarget.Android;
        PlayerSettings.SetIl2CppCompilerConfiguration(target, Il2CppCompilerConfiguration.Release);
        PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64 | AndroidArchitecture.ARMv7;
    }
}

API names shift a little between Unity versions, so check your editor's script reference if one of these calls does not compile. On Unity 6, Build Profiles can hold separate settings per profile, which does the same job without a script.

Change the daily workflow

The fastest IL2CPP build is the one you skip.

  1. Iterate in the editor for logic and feel. Most bugs never need a device.
  2. Use Mono for Android dev builds when you are testing gameplay rather than platform behaviour. Mono builds are far quicker. Mono on Android only targets 32-bit ARM, so keep an older test phone handy, since some newer devices run 64-bit apps only. iOS always needs IL2CPP.
  3. Use scripts-only builds. With Development Build ticked, the Build Settings window offers a scripts-only option that skips the asset processing when only code changed.
  4. Batch device tests. Build once, test several changes, rather than building per change.
  5. Run full release builds overnight or on CI, not while you wait.

Treat IL2CPP release builds as a pipeline job, not a step in your edit loop. Your loop should be editor, then Mono or scripts-only, then IL2CPP when it matters.

Hardware still matters

The native compile runs in parallel across CPU cores. More cores and a fast NVMe SSD make a real difference, and a project sitting on a spinning disk or a network drive will always be slow.

If you have an older laptop, a modest desktop used only as a build machine can pay for itself in saved hours. A cheap cloud runner works too, as long as it keeps the cache between runs.

Watch for things that make it worse

Run a quick audit of your packages every few months. Removing unused ones helps both build time and your final build size.

What we would do

We would set up two scripted profiles on day one: Debug and ARM64 only for testing, Release with all needed architectures for shipping. We would exclude the project from antivirus, never delete Library without a reason, and cache it on CI.

Day to day we would stay in the editor and Mono as long as possible. Full IL2CPP builds go to the build machine, so nobody sits and watches a progress bar.

The short version

If build pipelines are eating your week, we are happy to compare notes.

Related reading: Unity mobile performance on low-end Android, Free tools solo devs use to ship faster

#Unity#Builds#Android#Tools#Development
Your turn

Got a game idea? We build it.

You bring the concept. We design, build, test and launch it, and you own 100% of the finished game.

Share Your Game Idea  →