Home

Awesome

Generic Burst Jobs in Unity

Support for generic, Burst compiled Jobs through automatic code analysis and generation

Requires Unity 2020.3 LTS or newer.


Installation (via Package Manager)

Additional Unity dependencies (these will be automatically installed):


Usage

The settings are located at Project Settings > Generic Burst Jobs. There you can manually run the source generator, change its output destination, and more. By default, the generator will run automatically when the Player application is built.

During code analysis, any job structs marked with Unity.Jobs.BurstCompileAttribute that contain generic parameters will be tracked. For each unique instance of these structs the source generator creates a corresponding Unity.Jobs.RegisterGenericJobTypeAttribute in the output script. It works even through several layers of generic parameters, where some may belong to a class and some to a method. As long as all generic arguments of the job structs can be inferred at compile time, they will be registered.

The code analyzer ignores all code that is not part of Unity's default scripting assemblies. To enable analysis of an external assembly, simply add this attribute to one of its scripts: [assembly: TriceHelix.GenericBurstJobs.ContainsGenericBurstJobs]

You can also exclude specific job structs or analysis of the default assemblies by utilizing TriceHelix.GenericBurstJobs.DisableGenericJobRegistryAttribute.


Limitations