Version: Unity 6.7 Alpha (6000.7)
Language : English
Burst compilation
Get started with Burst

Introduction to Burst

Burst is a compiler that works on a subset of C# referred to in the Unity context as High-Performance C# (HPC#). Burst uses LLVM to translate .NET Intermediate Language (IL) to code that’s optimized for performance on the target CPU architecture.

Burst was originally designed for use with Unity’s job system. Jobs are structs that implement the IJob interface and represent small units of work that can run in parallel to make best use of all available CPU cores. Designing or refactoring your project to split work into Burst-compiled jobs can significantly improve the performance of CPU-bound code. For more information, refer to Write multithreaded code with the job system.

Aside from jobs, Burst can also compile static methods, as long as the code inside them belongs to the supported subset of C#. For more information on what’s included in High-Performance C#, refer to HPC# overview.

Burst is central to Unity’s Entity Component System (ECS) technologies, which includes a series of interdependent packages that work together to produce high performance code. However, Burst can be used independently of ECS and can be integrated into any Unity project that uses supported C# features.

Burst’s role in the compilation pipeline

Burst is not a complete scripting back end because it only supports a subset of C#. It can’t replace MonoA scripting backend used in Unity. More info
See in Glossary
or IL2CPPA Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info
See in Glossary
in your project but is supplemental to either of them.

The scripting back end compiles the code by default and Burst compiles whichever Burst-compatible parts of it are marked for Burst compilation.

Your C# scripts compile to Intermediate Language (IL) as usual. For methods marked for Burst, that IL is further compiled by Burst into native code. Burst compiles just-in-time (JIT) in the Unity Editor’s Play mode but ahead-of-time (AOT) in Player builds.

The subset of C# supported by Burst doesn’t support managed objects. Unity has libraries designed to provide Burst-compatible versions of common types and data structures. The Collections package offers Burst-compatible collections such as arrays and lists, and the Unity Mathematics APIs offer Burst-compatible mathematics functions.

Compiling with Burst

Code is Burst compiled if the following conditions are met:

You can use the scripting symbol ENABLE_BURST_AOT to conditionally compile sections of your code only when the Burst AOT compilation setting is enabled.

For more information, refer to Configure Burst compilation.

Additional resources

Burst compilation
Get started with Burst