docs.unity3d.com
    Show / Hide Table of Contents

    Class CloudAssetProvider

    A class that provides cloud assets. Users of this class will require a minimum Asset Manager Contributor role.

    Inheritance
    Object
    CloudAssetProvider
    CloudAssetManager
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Cloud.Assets
    Syntax
    public class CloudAssetProvider : IAssetProvider

    Constructors

    CloudAssetProvider(IServiceHttpClient, IServiceHostResolver, AssetServiceConfiguration)

    Initializes and returns an instance of CloudAssetProvider

    Declaration
    public CloudAssetProvider(IServiceHttpClient serviceHttpClient, IServiceHostResolver serviceHostResolver, AssetServiceConfiguration assetServiceConfiguration)
    Parameters
    Type Name Description
    IServiceHttpClient serviceHttpClient

    The IServiceHttpClient used to fetch the data.

    IServiceHostResolver serviceHostResolver

    The IServiceHostResolver object.

    AssetServiceConfiguration assetServiceConfiguration

    The asset service configuration object.

    Examples
    var httpClient = new UnityHttpClient();
    var serviceHostResolver = UnityRuntimeServiceHostResolverFactory.Create();
    var playerSettings = UnityCloudPlayerSettings.Instance;
    var platformSupport = PlatformSupportFactory.GetAuthenticationPlatformSupport();
    
    var compositeAuthenticatorSettings = new CompositeAuthenticatorSettingsBuilder(httpClient, platformSupport, serviceHostResolver)
        .AddDefaultPkceAuthenticator(playerSettings)
        .Build();
    
    var authenticator = new CompositeAuthenticator(compositeAuthenticatorSettings);
    
    var serviceHttpClient = new ServiceHttpClient(httpClient, authenticator, playerSettings);
    var assetServiceConfiguration = new AssetServiceConfiguration(true);
    
    m_AssetProvider = new CloudAssetProvider(serviceHttpClient, serviceHostResolver, assetServiceConfiguration);

    Properties

    Name

    The name of the provider.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    String
    Implements
    IAssetProvider.Name

    Methods

    AggregateAsync(IAssetSearchFilter, AggregationParameters, CancellationToken)

    Implement this method to get a count of assets that satisfy the search criteria.

    Declaration
    public Task<Aggregation> AggregateAsync(IAssetSearchFilter assetSearchFilter, AggregationParameters parameters, CancellationToken token)
    Parameters
    Type Name Description
    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    AggregationParameters parameters

    The object containing the necessary information for aggregation.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<Aggregation>

    A task whose result is a count of assets that satisfy the assetSearchFilter.

    Implements
    IAssetProvider.AggregateAsync(IAssetSearchFilter, AggregationParameters, CancellationToken)

    AggregateAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, AggregationParameters, CancellationToken)

    Implement this method to get a count of assets across specified projects that satisfy the search criteria.

    Declaration
    public Task<Aggregation> AggregateAsync(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, AggregationParameters parameters, CancellationToken token)
    Parameters
    Type Name Description
    IOrganization organization

    The organization in which the projects are.

    IEnumerable<IProject> projects

    The id of the projects in which to search.

    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    AggregationParameters parameters

    The object containing the necessary information for aggregation.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<Aggregation>

    A task whose result is a count of assets that satisfy the assetSearchFilter.

    Implements
    IAssetProvider.AggregateAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, AggregationParameters, CancellationToken)

    GetAssetAsync(IProject, String, Int32, CancellationToken)

    Implement this method to get a single IAsset.

    Declaration
    public async Task<IAsset> GetAssetAsync(IProject project, string assetId, int assetVersion, CancellationToken token)
    Parameters
    Type Name Description
    IProject project

    The id of the project the assetId belongs to.

    String assetId

    The id of the asset to retrieve.

    Int32 assetVersion

    The version number of the asset.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<IAsset>

    A task whose result is the requested IAsset.

    Implements
    IAssetProvider.GetAssetAsync(IProject, String, Int32, CancellationToken)

    GetAssetAsync<TAsset>(IProject, String, Int32, CancellationToken)

    Implement this method to get a single asset of type TAsset.

    Declaration
    public Task<TAsset> GetAssetAsync<TAsset>(IProject project, string assetId, int assetVersion, CancellationToken token)
        where TAsset : IAsset, new()
    Parameters
    Type Name Description
    IProject project

    The id of the project the assetId belongs to.

    String assetId

    The id of the asset to retrieve.

    Int32 assetVersion

    The version number of the asset.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    Task<TAsset>

    A task whose result is the requested IAsset.

    Type Parameters
    Name Description
    TAsset

    A type which inherits from IAsset.

    Implements
    IAssetProvider.GetAssetAsync<TAsset>(IProject, String, Int32, CancellationToken)

    SearchAsync(IAssetSearchFilter, Pagination, CancellationToken)

    Implement this method to get a collection of assets that satisfy the search criteria.

    Declaration
    public IAsyncEnumerable<IAsset> SearchAsync(IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
    Parameters
    Type Name Description
    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    Pagination pagination

    An object containing the necessary information return a range of IAsset matching the search criteria.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    IAsyncEnumerable<IAsset>

    A task whose result is an async enumeration of IAsset.

    Implements
    IAssetProvider.SearchAsync(IAssetSearchFilter, Pagination, CancellationToken)

    SearchAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, CancellationToken)

    Implement this method to get a collection of assets across specified projects that satisfy the search criteria.

    Declaration
    public IAsyncEnumerable<IAsset> SearchAsync(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
    Parameters
    Type Name Description
    IOrganization organization

    The organization in which the projects are.

    IEnumerable<IProject> projects

    The id of the projects in which to search.

    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    Pagination pagination

    An object containing the necessary information return a range of IAsset matching the search criteria.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    IAsyncEnumerable<IAsset>

    A task whose result is an async enumeration of IAsset.

    Implements
    IAssetProvider.SearchAsync(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, CancellationToken)

    SearchAsync<TAsset>(IAssetSearchFilter, Pagination, CancellationToken)

    Implement this method to get a collection of assets that satisfy the search criteria.

    Declaration
    public IAsyncEnumerable<TAsset> SearchAsync<TAsset>(IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
        where TAsset : IAsset, new()
    Parameters
    Type Name Description
    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    Pagination pagination

    An object containing the necessary information return a range of IAsset matching the search criteria.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    IAsyncEnumerable<TAsset>

    A task whose result is an async enumeration of IAsset.

    Type Parameters
    Name Description
    TAsset

    A type which inherits from IAsset.

    Implements
    IAssetProvider.SearchAsync<TAsset>(IAssetSearchFilter, Pagination, CancellationToken)

    SearchAsync<TAsset>(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, CancellationToken)

    Implement this method to get a collection of assets across specified projects that satisfy the search criteria.

    Declaration
    public IAsyncEnumerable<TAsset> SearchAsync<TAsset>(IOrganization organization, IEnumerable<IProject> projects, IAssetSearchFilter assetSearchFilter, Pagination pagination, CancellationToken token)
        where TAsset : IAsset, new()
    Parameters
    Type Name Description
    IOrganization organization

    The organization in which the projects are.

    IEnumerable<IProject> projects

    The id of the projects in which to search.

    IAssetSearchFilter assetSearchFilter

    The object containing the parameters for the asset search.

    Pagination pagination

    An object containing the necessary information return a range of IAsset matching the search criteria.

    CancellationToken token

    The cancellation token

    Returns
    Type Description
    IAsyncEnumerable<TAsset>

    A task whose result is an async enumeration of IAsset.

    Type Parameters
    Name Description
    TAsset

    A type which inherits from IAsset.

    Implements
    IAssetProvider.SearchAsync<TAsset>(IOrganization, IEnumerable<IProject>, IAssetSearchFilter, Pagination, 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