Version: Unity 6.2 (6000.2)
Language : English
Asset import determinism
AssetBundle and Addressables determinism

Editor script determinism

Scripts that modify assets during import or post-processingA process that improves product visuals by applying filters and effects before the image appears on screen. You can use post-processing effects to simulate physical camera and film properties, for example Bloom and Depth of Field. More info post processing, postprocessing, postprocess
See in Glossary
can unintentionally break build determinism. Before building, ensure that all generated assets are version-controlled and stable.

To prevent Unity Editor scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary
from causing non-deterministic builds, follow these guidelines:

  • Sort collected assets deterministically by GUID or asset path before assigning them to serialized fields.
  • Directory.GetFiles and AssetDatabase.FindAssets don’t guarantee sorted results.
  • Avoid deleting and re-importing assets before builds, because Unity generates new GUIDs for re-imported assets.

Avoid non-deterministic coding patterns such as the following:

  • Postprocessor scripts that mark assets dirty and re-save them during import.
  • AssetPostprocessor scripts that use random seeds or machine-specific paths.
  • Random or time-based values (Random.value, Guid.NewGuid, DateTime.Now, noise sampling) in asset generation.
  • Creating new ScriptableObject assets at build time, which generate different GUIDs per machine.
  • Modifying asset serialized data during the build process, because changes can be difficult to detect.

Pre-serialized runtime data determinism

In some workflows, tools generate pre-serialized runtime data such as Protobuf message binaries, JSON blobs, or other binary payloads during the build process and embed them into the build as assets or resources.

Even if the generated code is deterministic, the serialized data might not be. Review the official documentation or source of the serialization library to verify whether it produces deterministic output under identical inputs.

Avoid regenerating serialized data during every build. Instead, generate once, validate, and commit the data to version controlA system for managing file changes. You can use Unity in conjunction with most common version control tools, including Perforce, Git, Mercurial and PlasticSCM. More info
See in Glossary
.

Additional resources

Asset import determinism
AssetBundle and Addressables determinism