Skip to content

DependencyResultCache

ClassAssetInventoryAssetInventory.Editor
public sealed class DependencyResultCache

Cache for dependency calculation results to avoid redundant traversal of the same dependency trees. When File A and File B both depend on Material C, Material C's dependencies are only calculated once.

GetMaterializedPathKey(int, string, string)

Section titled “GetMaterializedPathKey(int, string, string)”
public static string GetMaterializedPathKey(int assetId, string guid, string path = null)

Generates a consistent cache key for materialized path storage. Format: “{assetId}{guid}” when GUID is available, or “path:{assetId}{path}” as fallback for files without GUIDs.

Parameters

NameType
assetIdSystem.Int32
guidSystem.String
pathSystem.String

Returns

System.String

public static string GetMaterializedPathKey(AssetInfo info)

Generates a consistent cache key for materialized path storage from AssetInfo. Uses GUID when available, falls back to Path for files without GUIDs.

Parameters

NameType
infoAssetInventory.AssetInfo

Returns

System.String

public static string GetMaterializedPathKey(int assetId, AssetFile file)

Generates a consistent cache key for materialized path storage from AssetFile. Uses GUID when available, falls back to Path for files without GUIDs.

Parameters

NameType
assetIdSystem.Int32
fileAssetInventory.AssetFile

Returns

System.String

TryGetDependencies(int, string, out CachedDependencyResult)

Section titled “TryGetDependencies(int, string, out CachedDependencyResult)”
public bool TryGetDependencies(int assetId, string guid, out DependencyResultCache.CachedDependencyResult result)

Try to get cached dependency result for a file. Key is scoped by AssetId to prevent cross-package cache contamination when files share the same GUID across different packages.

Parameters

NameType
assetIdSystem.Int32
guidSystem.String
resultAssetInventory.DependencyResultCache.CachedDependencyResult

Returns

System.Boolean

StoreDependencies(int, string, CachedDependencyResult)

Section titled “StoreDependencies(int, string, CachedDependencyResult)”
public void StoreDependencies(int assetId, string guid, DependencyResultCache.CachedDependencyResult result)

Store dependency calculation result for a file. Key is scoped by AssetId to prevent cross-package cache contamination when files share the same GUID across different packages.

Parameters

NameType
assetIdSystem.Int32
guidSystem.String
resultAssetInventory.DependencyResultCache.CachedDependencyResult
public void PreloadPackageFiles(int assetId, List<AssetFile> files)

Pre-load all AssetFile records for a package to eliminate repeated DB queries

Parameters

NameType
assetIdSystem.Int32
filesSystem.Collections.Generic.List{AssetInventory.AssetFile}
public AssetFile TryGetAssetFile(int assetId, string guid)

Try to get AssetFile by GUID from pre-loaded package cache Returns null if not found or package not pre-loaded

Parameters

NameType
assetIdSystem.Int32
guidSystem.String

Returns

AssetInventory.AssetFile

public bool HasPackageCache(int assetId)

Check if package files have been pre-loaded

Parameters

NameType
assetIdSystem.Int32

Returns

System.Boolean

TryGetMaterializedPath(string, out string)

Section titled “TryGetMaterializedPath(string, out string)”
public bool TryGetMaterializedPath(string key, out string path)

Try to get cached materialized path

Parameters

NameType
keySystem.String
pathSystem.String

Returns

System.Boolean

public void StoreMaterializedPath(string key, string path)

Store materialized asset path

Parameters

NameType
keySystem.String
pathSystem.String
public void InvalidateMaterializedPath(string key)

Remove a cached materialized path entry, e.g. when validation discovers the import at that path is broken (missing nested prefab references).

Parameters

NameType
keySystem.String
public DependencyResultCache.CacheStatistics GetStatistics()

Get cache statistics for debugging/logging

Returns

AssetInventory.DependencyResultCache.CacheStatistics

public void Clear()

Clear all caches

public DependencyResultCache()