TGViewer
Everyday Unity Everyday Unity @everydayunity · 1.18K subscribers
Post #2401 889
When, where, and why to put [BurstCompile], with mild under-the-hood explanation

A while ago, I was reviewing the burst inspector and noticed that only static methods were being bursted while others that I thought should qualify were not (no reference types, structs passed as ref args, etc.). After I had made these methods static, they were bursted right away. I was wondering why this was the case because I haven't seen that requirement in the docs (I probably just missed it). Anyway, I have recently found this thread which directly answers this question.

The first two things to know, from which all else flows, but seems a bit surprising at first:
1. Burst can only ever burst static methods, period, end of story. If you want this to happen outside of the special cases outlined below, just put [BurstCompile] on a static method and on its declaring type.* When you call this method, it will call the bursted version automatically, assuming burst compilation didn't fail.
2. Unless you try really hard, all C# called from bursted code is bursted.


https://forum.unity.com/threads/when-where-and-why-to-put-burstcompile-with-mild-under-the-hood-explanation.1344539/

#dots #ecs
  • 👍 6
  • 🔥 1
More from @everydayunity
  1. Sep 24, 2026Now you can change the effort mid session in new Claude. So the advice about caching from…
  2. Sep 24, 2026We were wondering in the comments what Claude reset does. Here is the answer https://www.r…
  3. Sep 22, 2026Introducing GPT‑6 Sol and Luna And better & cheaper sol and luna as an immediate response…
  4. Sep 22, 2026Introducing Claude Opus 5.5 \ Anthropic Cost and speed. Opus 5.5 requires less compute to…
  5. Sep 21, 2026Claude Code effort level and model selection effort means more than just "thinking time."…
  6. Sep 19, 2026Netcode for GameObjects 3.0.0 is now available It is preparation for Unity’s shared Netcod…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →