Build determinism is important if you want to be able to repeat a build process and get the same set of binary files. Creating a deterministic build enables regulatory compliance for industries requiring binary verification, and is a useful way to ensure that users don’t download unchanged content. Deterministic builds make unauthorized modifications easier to detect, and you can also track any bugs to their exact code and asset states.
Non-deterministic builds can happen in the following situations:
The most common cause of non-deterministic builds are mismatched environments. To ensure a consistent environment consider the following:
Consistent build machine environments: Keep operating system and CPU architecture consistent across all build machines. Floating-point rounding behavior differs between architectures, which can change serialized float values especially in AnimationClips or imported MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary data.
Consistent toolchains: Use the same Unity Editor version, Xcode version, and toolchains across builds. Small serialization changes between Unity versions can change AssetBundle byte layouts.
Disable automatic new line conversion in Git: Windows and macOS encode line endings differently, and automatic line conversion modifies file hashes and breaks determinism. To disable automatic conversion, run the following git command:
git config --global core.autocrlf false
To achieve deterministic builds in Unity, the most effective method is to force all machines to share identical imported assets via Unity Accelerator.
When multiple developers connect to the same remote AcceleratorThe Unity Accelerator is an external tool that provides an asset cache that keeps copies of a team’s imported assets. The goal of the Accelerator is to speed up teamwork and reduce iteration time by coordinating asset sharing so that you don’t need to reimport portions of your project. More info
See in Glossary, each machine reuses the same imported artifacts instead of re-importing locally.
Unity Accelerator has the following limitations: