UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

editor

[Burst] Resolve BC1091 Static Constructor Compilation Errors

Solution

debuggingeditorpackagesbursttroubleshooting

Unity 2019.4.x - Unity 6.3.x

Published Thu, Mar 26

Issue

 A BC1091 error is thrown when Burst encounters HashCode.Combine or other external calls within a static constructor, specifically within the Unity.MemoryProfiler.Editor package.

This prevents successful Burst compilation for the affected assembly in the editor, though it typically falls back to managed code execution.

Quick-Fix

Updating the Burst package to the latest version resolves compilation issues involving static constructors and HashCode.Combine.

Expand Analysis

The BC1091 error occurs because the Burst compiler version installed in your project does not support internal calls within static constructors. This is most prevalent when using the Unity.MemoryProfiler.Editor package which utilizes HashCode.Combine.

Because Burst fails gracefully, the editor falls back to the managed version of the code, but the error persists in the console until the package is updated.

  1. Open the Window > Package Manager menu.
  2. Locate the Burst package in the list.
  3. Click Update to fetch the latest version compatible with your project.
  4. Close and reopen the Unity Editor to allow Burst to re-index the assemblies.

Additional Tips

  • Verify that your Burst package is at least version 1.8.12 or higher to ensure the most stable intrinsic support for newer .NET features.
  • If your custom Burst code requires hashing, ensure it does not rely on consistent values between managed and Burst contexts, as HashCode.Combine outputs can vary between the two environments.

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.