docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AssetExtensions

    Extension methods for IAsset.

    Inheritance
    object
    AssetExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Cloud.Assets
    Assembly: Unity.Cloud.Assets.dll
    Syntax
    public static class AssetExtensions

    Methods

    AddReferenceAsync(IAsset, AssetDescriptor, CancellationToken)

    Creates a reference between the asset and another asset, where the asset is the source of the reference.

    Declaration
    public static Task<IAssetReference> AddReferenceAsync(this IAsset asset, AssetDescriptor targetAssetDescriptor, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    An asset.

    AssetDescriptor targetAssetDescriptor

    The descriptor of the asset which is a target.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<IAssetReference>

    A task whose result is the reference between the assets.

    AddTagsAsync(IAsset, IEnumerable<string>, CancellationToken)

    Adds the specified tags to the asset if they are not already present.

    Declaration
    public static Task AddTagsAsync(this IAsset asset, IEnumerable<string> tagsToAdd, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    An asset.

    IEnumerable<string> tagsToAdd

    A set of tags to add.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task

    A task with no result.

    GetPreviewDatasetAsync(IAsset, CancellationToken)

    Returns the Preview dataset for the asset.

    Declaration
    public static Task<IDataset> GetPreviewDatasetAsync(this IAsset asset, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<IDataset>

    A task whose result is an IDataset.

    GetSourceDatasetAsync(IAsset, CancellationToken)

    Returns the Source dataset for the asset.

    Declaration
    public static Task<IDataset> GetSourceDatasetAsync(this IAsset asset, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<IDataset>

    A task whose result is an IDataset.

    GetUpdateHistoryAsync(IAsset, DatasetUpdateHistoryDescriptor, CancellationToken)

    Returns a dataset's update history.

    Declaration
    public static Task<DatasetUpdateHistory> GetUpdateHistoryAsync(this IAsset asset, DatasetUpdateHistoryDescriptor datasetUpdateHistoryDescriptor, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    DatasetUpdateHistoryDescriptor datasetUpdateHistoryDescriptor

    The DatasetUpdateHistoryDescriptor of the asset.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<DatasetUpdateHistory>

    A task whose result is a DatasetUpdateHistory.

    GetUpdateHistoryAsync(IAsset, FileUpdateHistoryDescriptor, CancellationToken)

    Returns a file's update history.

    Declaration
    public static Task<FileUpdateHistory> GetUpdateHistoryAsync(this IAsset asset, FileUpdateHistoryDescriptor fileUpdateHistoryDescriptor, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    FileUpdateHistoryDescriptor fileUpdateHistoryDescriptor

    The FileUpdateHistoryDescriptor of the asset.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<FileUpdateHistory>

    A task whose result is a FileUpdateHistory.

    GetUpdateHistoryAsync(IAsset, DatasetId, int, CancellationToken)

    Returns a dataset's update history.

    Declaration
    public static Task<DatasetUpdateHistory> GetUpdateHistoryAsync(this IAsset asset, DatasetId datasetId, int updateHistorySequenceNumber, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    DatasetId datasetId

    The DatasetId.

    int updateHistorySequenceNumber

    The update history sequence number of the asset.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<DatasetUpdateHistory>

    A task whose result is a DatasetUpdateHistory.

    GetUpdateHistoryAsync(IAsset, DatasetId, string, int, CancellationToken)

    Returns a file's update history.

    Declaration
    public static Task<FileUpdateHistory> GetUpdateHistoryAsync(this IAsset asset, DatasetId datasetId, string filePath, int updateHistorySequenceNumber, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    DatasetId datasetId

    The DatasetId.

    string filePath

    The file path.

    int updateHistorySequenceNumber

    The update history sequence number of the asset.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<FileUpdateHistory>

    A task whose result is a FileUpdateHistory.

    ListUpdateHistoriesAsync(IAsset, Range, CancellationToken)

    Returns the update histories of the asset.

    Declaration
    public static IAsyncEnumerable<AssetUpdateHistory> ListUpdateHistoriesAsync(this IAsset asset, Range range, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    Range range

    The range of results to return.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    IAsyncEnumerable<AssetUpdateHistory>

    An async enumeration of AssetUpdateHistory in descending order of SequenceNumber.

    RemoveTagsAsync(IAsset, IEnumerable<string>, CancellationToken)

    Removes all instances of the specified tags from the asset.

    Declaration
    public static Task RemoveTagsAsync(this IAsset asset, IEnumerable<string> tagsToRemove, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    An asset.

    IEnumerable<string> tagsToRemove

    A set of tags to remove.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task

    A task with no result.

    UpdateAsync(IAsset, AssetUpdateHistory, CancellationToken)

    Updates the asset to the state it had at the specified update history sequence number.

    Declaration
    public static Task UpdateAsync(this IAsset asset, AssetUpdateHistory assetUpdateHistory, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    AssetUpdateHistory assetUpdateHistory

    The update history entry to which the asset should be updated.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task

    A task with no result.

    WithLatestVersionAsync(IAsset, CancellationToken)

    Returns the latest version of the asset.

    Declaration
    public static Task<IAsset> WithLatestVersionAsync(this IAsset asset, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<IAsset>

    A task whose result is an IAsset.

    WithVersionAsync(IAsset, int, CancellationToken)

    Returns the version of the asset with the specified sequence number.

    Declaration
    public static Task<IAsset> WithVersionAsync(this IAsset asset, int frozenSequenceNumber, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IAsset asset

    The asset to query.

    int frozenSequenceNumber

    The sequence number of the version of the asset to fetch.

    CancellationToken cancellationToken

    A token that can be used to cancel the request.

    Returns
    Type Description
    Task<IAsset>

    A task whose result is the IAsset with the frozen version attributed to the specified sequence number.

    Exceptions
    Type Condition
    NotFoundException

    If a version with the corresponding frozenSequenceNumber is not found.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)