Code inspection: Writing to a static field is not supported
Burst does not support writing to static state. This usually happens inside a [BurstCompile] job or another Burst-compiled method.
Example
In this example, the counter field is declared as static. Writing to it inside the Execute method of a [BurstCompile] job is not supported.
using Unity.Burst;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
private static int counter;
public void Execute()
{
// Reported: Writing to a static field is not supported
counter = 1;
}
}
using Unity.Burst;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
public int counter;
public void Execute()
{
// Correct: Use instance fields or native containers instead
counter = 1;
}
}
Quick-fix
This inspection does not provide a dedicated quick-fix. Fix it manually by removing the static write and moving the state into Burst-compatible data, such as instance fields, job data, or a supported native container.
26 March 2026