Vixen
02b45cc4
csharp
public sealed class AssetDatabase

Every asset in a project, by GUID and by path.

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

Remarks

The GUID is the identity and the path is a fact about today. Everything stored in a file — a material's reference to a texture, a scene's reference to a prefab — is a GUID, so moving, renaming or reorganising folders changes nothing anywhere. This is the thing that makes that true: the one place that knows which GUID is currently at which path.

Rebuilt by scanning sidecars, and only their envelopes. [08](../../docs/plan/08-asset-pipeline-and-addressables.md) budgets a hundred-thousand asset rebuild at under ten seconds. That is achievable because MetaScanner reads three lines of each file and stops, and because the files are read in parallel — this is an I/O-bound walk, and the machine has cores idle during it.

Nothing here is silently tolerant. A file with no sidecar gets one; a sidecar with no file is moved aside rather than deleted, because a mis-ordered git operation should be recoverable; two assets claiming one GUID — the copy-pasted-folder disaster — are resolved by rule and reported by name. Silent tolerance is how projects rot, and every one of those is a real thing that happens to real projects weekly.

Fields and properties (3)

  • public ProjectPaths Paths

    Where the project's directories are.

  • public int Count

    How many assets are indexed.

  • public IReadOnlyCollection<AssetEntry> Entries

    Every asset, in no particular order.

Methods (7)

  • public AssetDatabase(ProjectPaths paths)

    Opens a database over a project.

  • public bool TryGetByGuid(AssetId guid, out AssetEntry entry)

    Finds an asset by its identity.

  • public bool TryGetByPath(string relativePath, out AssetEntry entry)

    Finds an asset by where it is.

  • public ScanReport Scan(ScanOptions? options = null)

    Rebuilds the index from the sidecars on disk.

  • public void Save()

    Writes the index to Library/GuidIndex.

  • public bool TryLoad()

    Reads the index back, if it is there.

  • public bool IsStale()

    Whether the sidecars on disk have moved on since the index was written.

Used by (46, showing 40)

  • AddressableGroupEditorFactoryVixen.Editor.AssetEditors
  • AddressableGroupsViewVixen.Editor.AssetEditors
  • AnimationBinderVixen.Editor.AssetEditors
  • AnimationWiringTestsVixen.Editor.App.Tests
  • AssetDatabaseTestsVixen.Editor.Core.Tests
  • AssetEditorRegistryVixen.Editor.AssetEditors
  • AssetEditorRegistryTestsVixen.Editor.AssetEditors.Tests
  • AssetOperationTestsVixen.Editor.Core.Tests
  • AssetOperationsVixen.Editor.Core
  • AssetPickerVixen.Editor.App
  • AssetPickerTestsVixen.Editor.App.Tests
  • AssetSearchSourceVixen.Editor.App
  • AssetWatchTestsVixen.Editor.App.Tests
  • ContentPipelineVixen.Editor.Assets
  • DiagnosticsModuleVixen.Editor.Diagnostics
  • DoctorRunnerVixen.Cli
  • DropIntoFieldTestsVixen.Editor.App.Tests
  • DropIntoSceneTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorContentVixen.Editor.App
  • EditorContextVixen.Editor.Core
  • EditorProjectVixen.Editor.Core
  • EditorProjectTestsVixen.Editor.Core.Tests
  • EditorViewTestsVixen.Editor.AssetEditors.Tests
  • FontDocumentVixen.Editor.AssetEditors
  • GridViewTestsVixen.Editor.App.Tests
  • ImportPipelineVixen.Editor.Assets
  • ImportPipelineTestsVixen.Editor.Assets.Tests
  • LooseContentTestsVixen.Editor.Assets.Tests
  • MaterialViewVixen.Editor.AssetEditors
  • MilestoneE3TestsVixen.Editor.App.Tests
  • MilestoneE5TestsVixen.Editor.App.Tests
  • ProjectVixen.Cli
  • ProjectAssetVixen.Editor.App
  • ProjectBrowserVixen.Editor.App
  • ProjectMeshBakerVixen.Editor.App
  • ProjectTreeStateTestsVixen.Editor.App.Tests
  • ProjectWorkspaceVixen.Editor.Assets
  • ReferenceIndexVixen.Editor.Core
  • ReferenceIndexTestsVixen.Editor.Core.Tests