コードインスペクション:静的フィールドへの書き込みはサポートされていません
Burst は静的状態への書き込みをサポートしていません。 これは通常、 [BurstCompile] ジョブ内、Burst でコンパイルされた別のメソッド内で発生します。
サンプル
この例では、 counter フィールドは static として宣言されています。 [BurstCompile] ジョブの Execute メソッド内でこのフィールドへの書き込みはサポートされていません。
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;
}
}
クイックフィックス
このインスペクションには専用のクイックフィックス機能がありません。 静的書き込みを削除し、状態をインスタンスフィールド、ジョブデータ、サポートされているネイティブコンテナーなどの Burst 互換データに移動することで、手動で修正してください。
2026 年 6 月 12 日