docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Use case: Start a transformation on a dataset

    You can use the Unity Cloud Assets package to start any transformation on a given dataset. You can also fetch any previously started transformations.

    The SDK supports different workflows for users with different roles:

    Organization or Asset Manager Project role List transformations Start transformations
    Asset Management Viewer no no
    Asset Management Consumer yes no
    Asset Management Contributor yes yes
    Organization Owner yes yes

    Before you start

    Before you start, you must:

    1. Set up a Unity scene in the Unity Editor with an Organization and Project browser. See Get started with Asset Management for more information.

    2. Have some assets in the cloud. There are several ways to do so:

      • You can create assets through the Get started with Asset Management.
      • You can create assets through the dashboard; see the Managing assets on the dashboard documentation.

    How do I...?

    Start a transformation

    To start a transformation on a dataset, follow these steps:

    1. Open the AssetManagementBehaviour script you created.
    2. Add the following code to the end of the class:
    
    public async Task StartTransformationOnDataset(IDataset dataset, WorkflowType workflowType)
    {
        try
        {
            var creation = new TransformationCreation
            {
                WorkflowType = workflowType
            };
    
            var transformation = await dataset.StartTransformationAsync(creation, CancellationToken.None);
            Debug.Log($"Transformation started: {transformation.Descriptor.TransformationId}");
        }
        catch (Exception e)
        {
            Debug.LogError($"Failed to start transformation. {e}");
            throw;
        }
    }
    
    
    

    The code snippet starts a transformation on a selected dataset.

    Get a transformation

    To get a transformation that has been previously started on a dataset, whether already completed or not, follow these steps:

    1. Open the AssetManagementBehaviour script you created.
    2. Add the following code to the end of the class:
    
    public async Task StartTransformationOnDataset(IDataset dataset, TransformationId transformationId)
    {
        try
        {
            var transformation = await dataset.GetTransformationAsync(transformationId, CancellationToken.None);
            Debug.Log($"Transformation {transformation.Descriptor.TransformationId} current status is {transformation.Status}");
        }
        catch (Exception e)
        {
            Debug.LogError($"Failed to get transformation. {e}");
            throw;
        }
    }
    
    
    

    The code snippet gets a transformation that has been previously started on the dataset.

    In This Article
    Back to top
    Copyright © 2024 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)