Vixen
02b45cc4
csharp
public readonly record struct ArtifactKey

What decides whether an importer runs at all.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

xxh128(importerType, importerVersion, sourceHash, settingsHash, target, sorted(dependencyArtifactIds)), exactly as [08](../../docs/plan/08-asset-pipeline-and-addressables.md) specifies. A hit skips the importer entirely.

Every part earns its place by naming something that, when it changes, must produce a different artefact:

importerType and importerVersion — "I fixed the mip filter, re-import everything" is a version bump and nothing else. sourceHash — the artist changed the file. settingsHash — someone changed a setting in the inspector. target — the same texture is BC7 on a desktop and ASTC on a phone, and the two must not share a cache entry. dependencies — the texture a material points at was replaced, so the material's artefact is stale even though nothing about the material changed.

The dependencies are sorted, and that is not tidiness. A key that depended on the order a set enumerated in would differ between two machines with identical inputs, which turns a shared artefact cache from a speed-up into a source of confusion — and doc 08 wants exactly that cache shared across CI machines.

Fields and properties (1)

Methods (6)

  • public ArtifactKey(ObjectId Value)

    What decides whether an importer runs at all.

  • public override string ToString()

    Renders the key as 32 lowercase hex digits.

  • public static ArtifactKey Compute(string importer, int importerVersion, ObjectId sourceHash, ObjectId settingsHash, string target, IEnumerable<ObjectId>? dependencies = null)

    Computes a key.

  • public static ObjectId HashOf(Stream content)

    Hashes a stream of bytes — a source file, an artefact.

  • public static ObjectId HashOf(ReadOnlySpan<byte> content)

    Hashes a span of bytes.

  • public static ObjectId HashOf(string text)

    Hashes text — the emitted form of a settings block.

Used by (4)

  • ArtifactKeyTestsVixen.Editor.Assets.Tests
  • ImportCacheVixen.Editor.Assets
  • ImportPipelineVixen.Editor.Assets
  • ImportRecordVixen.Editor.Assets