docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Use case: Start a transformation on a dataset

    Use the Unity Cloud Assets package to perform the following:

    • Start transformations on a given dataset.
    • Fetch any previously started transformations.
    Note

    To manage assets, you need the Asset Manager Admin role at the organization level or the Asset Manager Contributor add-on role at the project level. Asset Manager Contributors can manage assets only for the specific projects to which they have access.

    Before you start

    Before you start, do the following:

    1. Verify you have the required permissions. Read more about verifying permissions.

      Note

      Asset Manager roles define the permissions that you have for a single Asset Manager project. Depending on your work, permissions may vary across projects.

    2. Set up a Unity scene in the Unity Editor with an Organization and Project browser. Read more about setting up a Unity scene.

    3. Create assets in Unity Cloud any of the following ways:

      • Add assets using the Asset SDK.
      • Add a single asset or multiple assets through the dashboard.

    How do I...?

    Start a transformation

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

    1. Open the AssetManagementBehaviour script that you created as described in Get started with Asset SDK.
    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 transformationDescriptor = await dataset.StartTransformationLiteAsync(creation, CancellationToken.None);
            Debug.Log($"Transformation started: {transformationDescriptor.TransformationId}");
        }
        catch (Exception e)
        {
            Debug.LogError($"Failed to start transformation. {e}");
            throw;
        }
    }
    
    public async Task StartCustomTransformationOnDataset(IDataset dataset, string workflowName)
    {
        try
        {
            var creation = new TransformationCreation
            {
                WorkflowType = WorkflowType.Custom,
                CustomWorkflowName = workflowName
            };
    
            var transformationDescriptor = await dataset.StartTransformationLiteAsync(creation, CancellationToken.None);
            Debug.Log($"Transformation started: {transformationDescriptor.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, regardless of its completion status, follow these steps:

    1. Open the AssetManagementBehaviour script that you created as described in Get started with Asset SDK.
    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);
            var transformationProperties = await transformation.GetPropertiesAsync(CancellationToken.None);
            Debug.Log($"Transformation {transformation.Descriptor.TransformationId} current status is {transformationProperties.Status}");
        }
        catch (Exception e)
        {
            Debug.LogError($"Failed to get transformation. {e}");
            throw;
        }
    }
    
    
    

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

    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)