Apply the [BurstCompile] attribute to the parts of your code you want Burst to compile. You can apply the [BurstCompile] attribute to the following:
[BurstCompile] to a job definition, Burst compiles everything within the job. For more information on jobs, refer to Job system.[BurstCompile] to a class definition if the class contains static methods that are also marked with [BurstCompile]. Burst can’t compile the class itself but only its member methods.[BurstCompile] to a regular (non-job) struct definition if the struct contains static methods that are also marked with [BurstCompile].[BurstCompile] to the method and its parent type. To work with dynamic functions that process data based on other data states, refer to Function pointers.[BurstCompile] to an assembly to set options for all Burst jobs and function-pointers within the assembly. For more information, refer to Defining Burst options for an assembly.
Note: You don’t always need to mark a method with the [BurstCompile] attribute for Burst to compile it. Any method where the program execution switches from managed to Burst-compiled code is referred to as a Burst entry point. If a static entry point method is marked with [BurstCompile], Burst also compiles any methods it calls into, even if they’re not marked [BurstCompile].
You can supply parameters to the [BurstCompile] attribute to modify aspects of compilation and improve Burst’s performance. You can use attribute parameters to:
For example, you can use the [BurstCompile] attribute to change the floating precision and float mode of Burst as follows:
[BurstCompile(FloatPrecision.Medium, FloatMode.Fast)]
For more information on configuring precision and determinism in floating point calculations, refer to Float precision and determinism.