Create a pipeline

How to create a pipeline using the Unity Automation feature.
Read time 2 minutesLast updated a month ago

Create a pipeline that performs custom Pixyz transformations on 3D assets hosted by Unity Asset Manager.

Overview

Unity Automation serves to create custom Pixyz transformations for 3D assets hosted by Unity Asset Manager. To help you get started, a simple template is available on the Unity Cloud dashboard.

Create a Pixyz pipeline

  1. Go to the Automation service on the cloud dashboard.
  2. In the left navigation bar, select Pipelines.
  3. Select + Create pipeline.
Pixyz pipeline template
In the current alpha release this page is a fixed template with three steps that can only be slightly configured. The first step downloads files from an asset in the Unity Asset Manager using the identifiers provided by the
Pipeline Parameters
. The second step transforms the files using the Pixyz SDK and a Python script you must provide. The third and final step uploads the transformed files back to Unity Asset Manager.
To create your pipeline, follow these steps:

1. Configure pipeline details

  • In the right side panel, select the Pipeline Details tab.
  • Enter a name and description for your pipeline. This information is displayed when the pipeline runs and when viewing jobs. Ensure the name and description provide enough context for users to understand the pipeline's purpose and the expected outcome.
  • The Pipeline Parameters section below includes several preconfigured parameters. These parameters are required to download and upload files to the Unity Asset Manager. You can also add more parameters to include additional data for running your Pixyz script.

2. Configure Pixyz

Select the second step Run Custom Script in Pixyz. Provide a Python script that runs a Pixyz SDK transformation. Paste the following sample
.glb
conversion Python script into the Upload script field.
import argparse
import os
import pxz
import uuid
from urllib.parse import unquote

print("Custom Pixyz transformation - Execution started...")

# Parse command line arguments (if any) from Unity Automation
cmd_line_parser = argparse.ArgumentParser()
cmd_line_parser.add_argument("--inputFiles", nargs="+")
cmd_line_parser.add_argument("--inputDirectory", type=str)
cmd_line_parser.add_argument("--outputDirectory", type=str)
args, unknown = cmd_line_parser.parse_known_args()

# Create the output directory if it does not exist
if not (os.path.exists(args.outputDirectory)):
    os.makedirs(args.outputDirectory)

# Enable verbose Pixyz logging
pxz.core.addConsoleVerbose(pxz.core.Verbose.INFO)
pxz.core.configureInterfaceLogger(True, True, True)

# ----- Custom Pixyz logic -----

# Import the input files
file_paths = list((f"{args.inputDirectory}/{unquote(file)}" for file in args.inputFiles))
pxz.io.importFiles(file_paths)

# (optional) transform and optimize the file

# Export the file as a given format
default_output_name = f"output_{uuid.uuid4().hex}.glb"
output_name = default_output_name
pxz.io.exportScene(f"{args.outputDirectory}/{output_name}")

# Inform Unity Automation to stop executing this pipeline step
exit(0)

3. Submit your pipeline

After you configure the Pipeline Details and set up the Pixyz step, at the bottom of the right-side panel, verify that:
  • All steps show a green checkmark.
  • The Create button is enabled.
  • Select Create to complete your pipeline setup. The pipeline appears on the Pipelines page, where you can run it.