Vixen
02b45cc4
csharp
public sealed class ReferenceIndex

Who points at what, so that "what breaks if I delete this" has an answer.

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

Remarks

A textual scan for vx:, not a parse. That is sound rather than lazy, and it is sound because of how the reference format was chosen: doc 08 picked a single prefixed scalar over Unity's three-key flow mapping partly so that rg 'vx:9e8a44c9' finds every referrer. This is that grep, done once over the project and kept.

Parsing instead would mean binding every scene, material and prefab in the project — the expensive half of opening one — to answer a question that is asked about one asset at a time. It would also fail on exactly the files most likely to matter: an asset whose importer has been uninstalled cannot be bound, but it can still be read, and "which of my scenes still references this" is the question you ask about that asset.

What a scan can do that a parse cannot is find a reference in a comment or a string. That is a false positive in a report nobody is harmed by, and the alternative — a missed reference in a "safe to delete" answer — is a corrupted project.

Fields and properties (1)

  • public int Count

    How many assets reference at least one other.

Methods (5)

  • public void Build(AssetDatabase database)

    Builds the index over everything in a database.

  • public IReadOnlyCollection<AssetId> ReferrersOf(AssetId asset)

    Everything that points at an asset.

  • public IReadOnlyCollection<AssetReference> ReferencesFrom(AssetId asset)

    Everything an asset points at.

  • public bool IsReferenced(AssetId asset)

    Whether anything would break if an asset were deleted.

  • public static List<AssetReference> Scan(ReadOnlySpan<char> text)

    Finds every reference in a piece of text.

Used by (11)

  • AssetOperationTestsVixen.Editor.Core.Tests
  • AssetOperationsVixen.Editor.Core
  • AssetSearchSourceVixen.Editor.App
  • EditorApplicationVixen.Editor.App
  • EditorContextVixen.Editor.Core
  • EditorProjectVixen.Editor.Core
  • EditorProjectTestsVixen.Editor.Core.Tests
  • ProjectAssetVixen.Editor.App
  • ProjectBrowserVixen.Editor.App
  • ReferenceIndexTestsVixen.Editor.Core.Tests
  • ScenarioTestsVixen.Editor.App.Tests