Unity builds getting stuck at "Compiling Assembly" when using IL2CPP and Burst 2.0 is a common issue that can waste hours of development time. This comprehensive guide provides proven solutions to fix build process hangs and get your IL2CPP + Burst 2.0 builds completing successfully.
The Problem: IL2CPP + Burst 2.0 Builds Stuck at "Compiling Assembly"
Common Symptoms:
- Build process hangs at "Compiling Assembly" step
- Unity appears frozen with no progress indicator
- Build takes hours or never completes
- High CPU usage but no disk activity
- Console shows compilation warnings but build doesn't progress
- Build succeeds but takes extremely long time (30+ minutes)
Why This Happens: IL2CPP + Burst 2.0 build hangs are typically caused by:
- Large codebase compilation exceeding memory limits
- Burst compilation errors that cause silent failures
- Insufficient system resources (RAM, disk space, CPU)
- Corrupted Burst cache causing repeated compilation attempts
- IL2CPP code generation issues with complex C# code
- Burst job compilation conflicts with IL2CPP backend
- Missing or outdated Burst compiler installation
Solution 1: Clear Burst Cache and Rebuild (Quick Fix)
Corrupted Burst cache is the most common cause of compilation hangs. Clearing it forces a fresh compilation.
Step-by-Step Fix:
-
Close Unity Editor:
- Save all your work
- Completely quit Unity Editor
- Ensure no Unity processes are running
-
Clear Burst Cache:
- Navigate to:
Library/Bee/artifacts/ - Delete the entire
Beefolder - Navigate to:
Library/BeeBackend/ - Delete the entire
BeeBackendfolder - Navigate to:
Library/PlayerDataCache/ - Delete the entire
PlayerDataCachefolder
- Navigate to:
-
Clear IL2CPP Cache:
- Navigate to:
Library/Il2cppBuildCache/ - Delete the entire
Il2cppBuildCachefolder - Navigate to:
Temp/ - Delete all files in the
Tempfolder
- Navigate to:
-
Restart Unity and Rebuild:
- Open Unity Editor
- Open your project
- Go to File > Build Settings
- Click "Build" (not "Build and Run")
- Monitor the build process
Verification: Build should progress past "Compiling Assembly" within 5-10 minutes for typical projects.
Solution 2: Increase System Resources Allocation
IL2CPP + Burst 2.0 compilation is resource-intensive. Insufficient resources cause hangs.
For Memory Issues:
-
Check Available RAM:
- Open Activity Monitor (Mac) or Task Manager (Windows)
- Ensure at least 8GB free RAM available
- Close unnecessary applications
-
Increase Unity Memory Limits:
- Open Unity Editor
- Go to Edit > Preferences > External Tools
- Set "External Script Editor" memory limit higher
- Or use command-line build with increased heap size
-
Use 64-bit Build Process:
- Ensure Unity is running in 64-bit mode
- Check: Unity > About Unity should show "64-bit"
- IL2CPP requires 64-bit for large projects
For Disk Space Issues:
-
Check Available Disk Space:
- Ensure at least 10GB free space on build drive
- IL2CPP generates large intermediate files
- Burst compilation creates temporary artifacts
-
Change Build Location:
- Use external drive with more space if needed
- Go to File > Build Settings
- Change "Build Location" to drive with more space
Verification: Build should have sufficient resources to complete compilation without hanging.
Solution 3: Fix Burst Compilation Errors
Burst compilation errors can cause silent failures that appear as hangs. Check for Burst-specific issues.
Step-by-Step Fix:
-
Enable Burst Compilation Logging:
- Open Unity Editor
- Go to Edit > Project Settings > Player
- Expand "Other Settings"
- Under "Burst AOT Settings", enable "Enable Burst Compilation"
- Enable "Enable Burst Compilation Logging"
-
Check Console for Burst Errors:
- Open Console window (Window > General > Console)
- Look for red error messages containing "Burst"
- Common errors:
- "Burst compilation failed"
- "Burst job compilation error"
- "Unsupported code pattern in Burst job"
-
Fix Burst Incompatible Code:
- Burst doesn't support all C# features
- Remove
System.Reflectionusage in Burst jobs - Remove
stringoperations in hot paths - Remove
try-catchblocks in Burst-compiled code - Use
[BurstCompile]attribute correctly
-
Disable Burst for Problematic Jobs:
- If specific jobs cause issues, temporarily disable Burst:
// Remove [BurstCompile] attribute // [BurstCompile] public struct ProblematicJob : IJob { // Job code }
- If specific jobs cause issues, temporarily disable Burst:
-
Test Build Again:
- Clear cache (Solution 1)
- Attempt build
- Check if compilation progresses
Verification: Console should show no Burst errors, and build should progress normally.
Solution 4: Optimize IL2CPP Code Generation
IL2CPP can struggle with certain C# patterns. Optimize your code for IL2CPP compatibility.
Code Optimization Tips:
-
Reduce Generic Type Usage:
- IL2CPP generates code for each generic instantiation
- Excessive generics increase compilation time
- Use concrete types where possible
-
Simplify Complex Expressions:
- Break down complex LINQ queries
- Avoid deeply nested method calls
- Simplify lambda expressions
-
Reduce Reflection Usage:
- IL2CPP struggles with reflection-heavy code
- Use code generation or direct calls instead
- Minimize
GetType(),Invoke(), and attribute queries
-
Optimize String Operations:
- String concatenation creates garbage
- Use
StringBuilderfor multiple concatenations - Cache frequently used strings
-
Reduce Assembly References:
- Fewer assemblies = faster IL2CPP compilation
- Remove unused package dependencies
- Consolidate code into fewer assemblies
Verification: Code should compile faster with IL2CPP, reducing hang probability.
Solution 5: Update Unity and Burst Versions
Outdated Unity or Burst versions may have bugs causing compilation hangs.
Step-by-Step Fix:
-
Check Unity Version:
- Open Unity Editor
- Go to Help > About Unity
- Note your Unity version
- Check Unity release notes for IL2CPP/Burst fixes
-
Update Unity:
- Open Unity Hub
- Go to "Installs" tab
- Check for updates to your Unity version
- Install latest patch version (e.g., 2026.2.0b15 → 2026.2.0b16)
-
Update Burst Package:
- Open Package Manager (Window > Package Manager)
- Find "Burst" package
- Click "Update" if newer version available
- Or manually update in
Packages/manifest.json:"com.unity.burst": "1.8.15"
-
Update IL2CPP Backend:
- IL2CPP is part of Unity core
- Updating Unity updates IL2CPP automatically
- Ensure you're using latest Unity version
-
Test Build:
- Clear cache (Solution 1)
- Attempt build with updated versions
- Check if compilation progresses
Verification: Updated versions should have bug fixes that resolve compilation hangs.
Solution 6: Use Incremental Builds
Full rebuilds take longer and are more prone to hangs. Use incremental builds when possible.
Step-by-Step Fix:
-
Enable Incremental IL2CPP:
- Open File > Build Settings
- Click "Player Settings"
- Go to "Other Settings"
- Enable "Use incremental GC"
- IL2CPP will reuse previously compiled code
-
Build Incrementally:
- Make small code changes
- Build again (should be faster)
- Only changed assemblies recompile
-
Clean Build When Needed:
- If incremental builds fail, do clean build
- Delete
Library/folder (backup first) - Reimport project
- Build from scratch
Verification: Incremental builds should complete faster and reduce hang probability.
Solution 7: Monitor Build Process
Understanding where the build hangs helps identify the specific issue.
Build Monitoring Steps:
-
Enable Detailed Logging:
- Open Unity Editor
- Go to Edit > Preferences > General
- Enable "Show Compilation Time"
- Enable "Verbose Logging" in Console
-
Monitor Build Progress:
- Watch Console window during build
- Note which assembly is compiling when it hangs
- Check for memory warnings
- Monitor CPU and RAM usage
-
Check Build Logs:
- Navigate to:
Library/Logs/ - Open latest
Editor.logfile - Search for "IL2CPP" or "Burst" errors
- Look for stack traces or error messages
- Navigate to:
-
Identify Problematic Assembly:
- If build always hangs on same assembly, that assembly has issues
- Check that assembly's code for problems
- Consider splitting large assembly into smaller ones
Verification: You should identify which assembly or step causes the hang.
Solution 8: Alternative: Use Mono Backend Temporarily
If IL2CPP continues to hang, use Mono backend temporarily to unblock development.
Step-by-Step Fix:
-
Switch to Mono Backend:
- Open File > Build Settings
- Click "Player Settings"
- Go to "Other Settings"
- Find "Scripting Backend"
- Change from "IL2CPP" to "Mono"
-
Build with Mono:
- Build should complete faster
- Mono doesn't have IL2CPP compilation step
- Useful for development builds
-
Switch Back to IL2CPP for Release:
- Use Mono for development
- Switch to IL2CPP only for release builds
- IL2CPP provides better performance and security
Note: Mono backend has limitations (no Burst, larger builds, platform restrictions). Use only as temporary workaround.
Verification: Build should complete successfully with Mono backend.
Prevention Tips
Avoid Future Build Hangs:
-
Regular Cache Cleanup:
- Clear Burst and IL2CPP cache weekly
- Prevents cache corruption issues
-
Monitor Code Complexity:
- Keep assemblies reasonably sized
- Avoid excessive generic usage
- Simplify complex code patterns
-
Stay Updated:
- Update Unity regularly
- Update Burst package when available
- Check release notes for fixes
-
Test Builds Frequently:
- Don't wait until release to test IL2CPP builds
- Test IL2CPP builds weekly during development
- Catch issues early
-
Use Incremental Builds:
- Prefer incremental builds over clean builds
- Only do clean builds when necessary
- Saves time and reduces hang risk
Common Error Messages and Fixes
"Burst compilation failed":
- Check Burst-compatible code patterns
- Remove unsupported C# features
- Update Burst package
"IL2CPP code generation error":
- Simplify complex code
- Reduce reflection usage
- Check for unsupported patterns
"Out of memory during compilation":
- Increase available RAM
- Close other applications
- Reduce code complexity
"Build process timed out":
- Increase build timeout settings
- Use incremental builds
- Optimize code for faster compilation
Related Problems
If this fix didn't solve your issue, check these related help articles:
- Unity Build Fails with "Scripting Backend Error" - Complete Solution
- Unity Build Fails with "Out of Memory" Error - How to Fix
- Unity Performance Drops to 10 FPS - How to Fix (Optimization Guide)
- Unity C# Compilation Errors - How to Fix Common Issues
Still Having Issues?
If your IL2CPP + Burst 2.0 build is still stuck at "Compiling Assembly":
- Check Unity Forums: Search for your specific Unity version and error
- Review Unity Release Notes: Check for known issues in your version
- Try Clean Project: Create new project and import code incrementally
- Contact Unity Support: If issue persists, file a bug report with Unity
Bookmark this fix for quick reference - IL2CPP + Burst compilation issues can be frustrating, but these solutions should resolve most cases.
Share this article with your dev friends if it helped you get your builds working again!