Class BuildCache
Default implementation of the Build Cache
Inherited Members
Namespace: UnityEditor.Build.Pipeline.Utilities
Assembly: Unity.ScriptableBuildPipeline.Editor.dll
Syntax
public class BuildCache : IBuildCache, IContextObject, IDisposable
  Constructors
BuildCache()
Creates a new build cache object.
Declaration
public BuildCache()
  BuildCache(string, int)
Creates a new remote build cache object.
Declaration
public BuildCache(string host, int port = 8126)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | host | The server host.  | 
      
| int | port | The server port.  | 
      
Methods
Dispose()
Disposes the build cache instance.
Declaration
public void Dispose()
  GetCacheEntry(string, int)
Gets a CacheEntry for a file identified by its relative path.
Declaration
public CacheEntry GetCacheEntry(string path, int version = 1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | path | Relative path of a file on disk  | 
      
| int | version | Version number of the system asking for an entry to distinguish it from previous incompatible entries. (Optional)  | 
      
Returns
| Type | Description | 
|---|---|
| CacheEntry | CacheEntry representing a file on disk.  | 
      
GetCacheEntry(Type, int)
Gets a CacheEntry for a scripting type by a System.Type.
Declaration
public CacheEntry GetCacheEntry(Type type, int version = 1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Type | type | System.Type for a scripting type  | 
      
| int | version | Version number of the system asking for an entry to distinguish it from previous incompatible entries. (Optional)  | 
      
Returns
| Type | Description | 
|---|---|
| CacheEntry | CacheEntry representing an object identifier.  | 
      
GetCacheEntry(ObjectIdentifier, int)
Gets a CacheEntry for an object identified by an Object Identifier.
Declaration
public CacheEntry GetCacheEntry(ObjectIdentifier objectID, int version = 1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ObjectIdentifier | objectID | Object identifier for an object  | 
      
| int | version | Version number of the system asking for an entry to distinguish it from previous incompatible entries. (Optional)  | 
      
Returns
| Type | Description | 
|---|---|
| CacheEntry | CacheEntry representing an object identifier.  | 
      
GetCacheEntry(GUID, int)
Gets a CacheEntry for an asset identified by its GUID.
Declaration
public CacheEntry GetCacheEntry(GUID asset, int version = 1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| GUID | asset | GUID identifier for an asset from the Asset Database  | 
      
| int | version | Version number of the system asking for an entry to distinguish it from previous incompatible entries. (Optional)  | 
      
Returns
| Type | Description | 
|---|---|
| CacheEntry | CacheEntry representing current asset.  | 
      
GetCachedArtifactsDirectory(CacheEntry)
Returns the path where artifact data can be saved in the cache
Declaration
public string GetCachedArtifactsDirectory(CacheEntry entry)
  Parameters
| Type | Name | Description | 
|---|---|---|
| CacheEntry | entry | Cache entry to get the path  | 
      
Returns
| Type | Description | 
|---|---|
| string | Path on disk where to save cached artifacts  | 
      
GetCachedInfoFile(CacheEntry)
Returns the path where info data can be saved in the cache
Declaration
public string GetCachedInfoFile(CacheEntry entry)
  Parameters
| Type | Name | Description | 
|---|---|---|
| CacheEntry | entry | Cache entry to get the path  | 
      
Returns
| Type | Description | 
|---|---|
| string | Path on disk where to save cached info  | 
      
HasAssetOrDependencyChanged(CachedInfo)
Checks if the CachedInfo passed in needs to be rebuilt
Declaration
public bool HasAssetOrDependencyChanged(CachedInfo info)
  Parameters
| Type | Name | Description | 
|---|---|---|
| CachedInfo | info | Cached Info to check  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  | 
      
LoadCachedData(IList<CacheEntry>, out IList<CachedInfo>)
Loads a set of CachedInfos from the cache
Declaration
public void LoadCachedData(IList<CacheEntry> entries, out IList<CachedInfo> cachedInfos)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IList<CacheEntry> | entries | List of cache entries to load  | 
      
| IList<CachedInfo> | cachedInfos | Out list of cached infos loaded  | 
      
PruneCache()
Prunes the build cache so that its size is within the maximum cache size.
Declaration
public static void PruneCache()
  PruneCache_Background(long)
Prunes the build cache without showing UI prompts.
Declaration
public static void PruneCache_Background(long maximumCacheSize)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | maximumCacheSize | The maximum cache size.  | 
      
PurgeCache(bool)
Deletes the build cache directory.
Declaration
public static void PurgeCache(bool prompt)
  Parameters
| Type | Name | Description | 
|---|---|---|
| bool | prompt | The message to display in the popup window.  | 
      
SaveCachedData(IList<CachedInfo>)
Saves a set of CachedInfos to the cache
Declaration
public void SaveCachedData(IList<CachedInfo> infos)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IList<CachedInfo> | infos | List of cached infos to save  |