docs.unity3d.com
    Show / Hide Table of Contents

    Interface IAssetCollectionManager

    An interface that provides the methods to interact with an IAssetCollection.

    Namespace: Unity.Cloud.Assets
    Syntax
    public interface IAssetCollectionManager

    Methods

    CreateCollectionAsync(IProject, IAssetCollection, CancellationToken)

    Creates a new IAssetCollection at the specified path. in an IProject.

    Declaration
    Task<CollectionPath> CreateCollectionAsync(IProject project, IAssetCollection assetCollection, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The project in which the collection will reside.

    IAssetCollection assetCollection

    The collection to commit to the cloud.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<CollectionPath>

    A task whose result is the path to the new collection within the project.

    Examples
        async Task<string> CreateCollection(IProject project, CancellationToken cancellationToken)
        {
            var assetCollection = new AssetCollection("My Collection", "A description of my collection.");
            var collectionPath = await m_AssetCollectionManager.CreateCollectionAsync(project, assetCollection, cancellationToken);
    
            return collectionPath;
        }
    Exceptions
    Type Condition
    ArgumentNullException

    This exception is thrown if the IAssetCollection has invalid members.

    DeleteCollectionAsync(IAssetCollection, CancellationToken)

    Deletes the IAssetCollection at the specified path from an IProject.

    Declaration
    Task DeleteCollectionAsync(IAssetCollection assetCollection, CancellationToken token)
    Parameters
    Type Name Description
    IAssetCollection assetCollection

    The collection to remove from the cloud.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task

    A task with no result.

    Examples
        async Task DeleteCollection(IAssetCollection assetCollection, CancellationToken cancellationToken)
        {
            await m_AssetCollectionManager.DeleteCollectionAsync(assetCollection, cancellationToken);
        }

    GetCollectionAsync(IProject, CollectionPath, CancellationToken)

    Gets an IAssetCollection in an IProject.

    Declaration
    Task<IAssetCollection> GetCollectionAsync(IProject project, CollectionPath collectionPath, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The project in which the collection resides.

    CollectionPath collectionPath

    The path to a collection.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<IAssetCollection>

    A task whose result is the IAssetCollection at path collectionPath.

    Examples

    InsertAssetsToCollectionAsync(IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)

    Implement this method to insert assets into a collection in an IProject.

    Declaration
    Task InsertAssetsToCollectionAsync(IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The project the collection belongs to.

    CollectionPath collectionPath

    The path to the collection to be modified.

    IEnumerable<IAsset> assets

    The assets to add.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task

    A task with no result.

    Examples
        async Task CollectionInsert(IAssetCollection assetCollection, CancellationToken cancellationToken, params IAsset[] assets)
        {
            await m_AssetCollectionManager.InsertAssetsToCollectionAsync(assetCollection, assets, cancellationToken);
        }

    ListCollectionsAsync(IProject, CancellationToken)

    Gets the collections in an IProject.

    Declaration
    Task<IAssetCollection[]> ListCollectionsAsync(IProject project, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The project in which the collections reside.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<IAssetCollection[]>

    A task whose result is an array of collections.

    Examples
        async Task<IAssetCollection[]> ListCollections(IProject project, CancellationToken cancellationToken)
        {
            var collections = await m_AssetCollectionManager.ListCollectionsAsync(project, cancellationToken);
            return collections;
        }

    MoveCollectionToNewPathAsync(IAssetCollection, CollectionPath, CancellationToken)

    Implement this method to move a collection in an IProject to a new path.

    Declaration
    Task<string> MoveCollectionToNewPathAsync(IAssetCollection assetCollection, CollectionPath newCollectionPath, CancellationToken token)
    Parameters
    Type Name Description
    IAssetCollection assetCollection
    CollectionPath newCollectionPath
    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<String>

    A task whose result is the new path to the collection.

    Examples
        async Task MoveCollection(IAssetCollection assetCollection, CollectionPath newCollectionPath, CancellationToken cancellationToken)
        {
            await m_AssetCollectionManager.MoveCollectionToNewPathAsync(assetCollection, newCollectionPath, cancellationToken);
        }

    RemoveAssetsFromCollectionAsync(IProject, CollectionPath, IEnumerable<IAsset>, CancellationToken)

    Implement this method to remove assets from a collection in an IProject.

    Declaration
    Task RemoveAssetsFromCollectionAsync(IProject project, CollectionPath collectionPath, IEnumerable<IAsset> assets, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The project the collection belongs to.

    CollectionPath collectionPath

    The path to the collection to modified.

    IEnumerable<IAsset> assets

    The assets to remove.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task

    A task with no result.

    Examples
        async Task CollectionRemove(IAssetCollection assetCollection, CancellationToken cancellationToken, params IAsset[] assets)
        {
            await m_AssetCollectionManager.RemoveAssetsFromCollectionAsync(assetCollection, assets, cancellationToken);
        }

    UpdateCollectionAsync(IAssetCollection, CancellationToken)

    Updates an IAssetCollection in an IProject.

    Declaration
    Task UpdateCollectionAsync(IAssetCollection assetCollection, CancellationToken token)
    Parameters
    Type Name Description
    IAssetCollection assetCollection

    The collection to commit to the cloud.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task

    A task with no result.

    Examples
        async Task UpdateCollection(IAssetCollection assetCollection, CancellationToken cancellationToken)
        {
            assetCollection.SetName("A new name");
            assetCollection.SetDescription("A new description");
    
            await m_AssetCollectionManager.UpdateCollectionAsync(assetCollection, cancellationToken);
        }

    Extension Methods

    AssetCollectionExtensions.InsertAssetsToCollectionAsync(IAssetCollectionManager, IAssetCollection, IEnumerable<IAsset>, CancellationToken)
    AssetCollectionExtensions.RemoveAssetsFromCollectionAsync(IAssetCollectionManager, IAssetCollection, IEnumerable<IAsset>, CancellationToken)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023