Configurable import pipeline for Unity
This document describes command-line execution of JSON Data Importer from Unity batch mode: which commands to use in CI, what each command does, and which settings it overrides.
On Windows CI, Unity.com is more convenient to run: it sends stdout/stderr to the console better. Unity.exe can also work, but it is usually less convenient for logs.
$Unity = "C:\Program Files\Unity\Hub\Editor\6000.n\Editor\Unity.com"
$Project = "C:\projects\JsonDataImporter"
& $Unity -batchmode -nographics -quit `
-projectPath $Project `
-executeMethod Jdi.Cli.Run `
-logFile -
Required Unity arguments:
-batchmode - starts Unity without the interactive editor workflow.-nographics - disables graphics mode, useful for CI agents.-quit - closes Unity after the method finishes.-projectPath - path to the Unity project root.-executeMethod Jdi.Cli.Run - short namespaced entry point for the JDI CLI.-logFile - - writes Unity log to stdout; useful for CI logs.Jdi.Cli.Run is a short wrapper over JsonDataImporter.Editor.Batch.JsonDataImporterBatchCommands.RunFromCommandLine. The short entry point is namespaced so the package does not add global types.
Show help:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Help -logFile -
Alternatives:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run help -logFile -
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -- --help -logFile -
Pass --help after --, because Unity can reserve -help/--help for itself. Simple aliases help, ?, /?, /help, -jdiHelp, --jdiHelp are also supported.
Run a batch execution config by stable id:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -id DemoAllValid -logFile -
What the command does:
ImportBatchExecutionConfig asset with id == DemoAllValid;sources list from that asset;executionMode from that asset;ImportBatchExecutionConfig;This is the most stable CI option: the pipeline does not depend on a specific asset path when id is unique in the project.
For a set of CI scenarios, create several execution configs:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -id AllValid -logFile -
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -id MixedIndependent -logFile -
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -id ValidationOverride -logFile -
These ids must exist in ImportBatchExecutionConfig.id. The current demo set has DemoAllValid.
Run a specific ImportBatchExecutionConfig asset:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-ec "Assets/JsonDataImporter/Demo/Examples/BatchImport/Assets/AllValidBatchImportConfig.asset" `
-logFile -
What the command does:
-id;Asset path is passed as a Unity path like Assets/..., not as an absolute filesystem path.
Validate-only run for one source config:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-c "Assets/JsonDataImporter/Demo/Examples/PlainItems/Assets/PlainItemsImportConfig.asset" `
-logFile -
What the command does:
ImportSourceConfig;-c supports forms -c <AssetPath> and -c=<AssetPath>. Old alias -importConfig <AssetPath> is also supported.
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-c "Assets/JsonDataImporter/Demo/Examples/PlainItems/Assets/PlainItemsImportConfig.asset" `
--preview `
-logFile -
What the command does:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-c "Assets/JsonDataImporter/Demo/Examples/PlainItems/Assets/PlainItemsImportConfig.asset" `
--apply `
-logFile -
What the command does:
AssetDatabase.SaveAssets().If both --apply and --preview are passed, --apply has priority.
Validate-only run for all ImportSourceConfig assets in the project:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -all -logFile -
Preview for all configs:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -all --preview -logFile -
Apply for all configs:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -all --apply -logFile -
What -all does:
ImportSourceConfig;ImportJobRunner;If no ImportSourceConfig is found, the command exits with code 3.
Run all source configs only under the specified folder:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-all `
--folder="Assets/JsonDataImporter/Demo/Examples/PlainItems" `
-logFile -
What --folder does:
-all;ImportSourceConfig assets by Unity asset path;Assets/....--folder does not apply to -id and -ec, because execution config defines the sources list itself.
Run with JSON and text reports:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-id DemoAllValid `
--reportJson="Artifacts/import-report.json" `
--reportText="Artifacts/import-report.txt" `
-logFile -
What report flags do:
--reportJson writes a structured report through JsonUtility.ToJson(..., true);--reportText writes a human-readable summary;For -id/-ec, CLI report paths override reportJsonPath and reportTextPath saved in ImportBatchExecutionConfig.
For -c/-all, report paths come only from CLI flags.
Disable incremental skip for -c or -all:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-c "Assets/JsonDataImporter/Demo/Examples/PlainItems/Assets/PlainItemsImportConfig.asset" `
--apply `
--noIncremental `
-logFile -
Disable fingerprinting for -c or -all:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run `
-all `
--noFingerprinting `
-logFile -
By default, without --noIncremental or --noFingerprinting, CLI sets true instead of inheriting from profile; see the “What CLI Overrides” table for details.
For -id and -ec, these flags do not apply. To disable incremental skip or fingerprinting in an execution config run, configure enableIncrementalSkip or enableFingerprinting inside ImportBatchExecutionConfig.
The general policy value order is described in ImportSourceConfig Reference. This section records only CLI/batch-specific behavior.
ImportBatchExecutionConfig uses ImportBoolOverride:
Inherit becomes null and allows the value to come from ImportSourceConfig.executionProfile;true or false and has priority over the source execution profile.There are no CLI flags for backup or fail-on-validation, so these settings are inherited from source execution profile and then default true.
For -c and -all:
| CLI | Effect |
|---|---|
--apply |
ImportExecutionMode.Apply |
--preview |
ImportExecutionMode.PreviewOnly |
| no mode flag | ImportExecutionMode.ValidateOnly |
--targetTypeId=<id> |
overrides preferred target type id |
--folder=<path> |
filters configs only for -all |
--reportJson=<path> |
writes JSON report |
--reportText=<path> |
writes text report |
--noIncremental |
EnableIncrementalSkip = false |
no --noIncremental |
EnableIncrementalSkip = true |
--noFingerprinting |
EnableFingerprinting = false |
no --noFingerprinting |
EnableFingerprinting = true |
For -id and -ec:
| CLI | Effect |
|---|---|
-id <id> |
selects ImportBatchExecutionConfig by id |
-ec <path> |
selects ImportBatchExecutionConfig by asset path |
--reportJson=<path> |
overrides ImportBatchExecutionConfig.reportJsonPath |
--reportText=<path> |
overrides ImportBatchExecutionConfig.reportTextPath |
Other flags do not apply to run options for -id/-ec. Mode, sources, order, and optional boolean overrides come from ImportBatchExecutionConfig.
| Code | Meaning |
|---|---|
0 |
all jobs completed successfully |
2 |
validation failed, apply was blocked by validation errors, or diff errors were reported |
3 |
batch configuration/runtime error, missing assets, dependency blocked, lock blocked, or other failure |
Batch command computes the highest exit code among jobs. If at least one job has a non-zero code, Unity process exits with that code.
The old full entry point still works:
& $Unity -batchmode -nographics -quit -projectPath $Project `
-executeMethod JsonDataImporter.Editor.Batch.JsonDataImporterBatchCommands.RunFromCommandLine `
--executionConfigId=DemoAllValid `
-logFile -
For new CI scripts, the short form is preferred:
& $Unity -batchmode -nographics -quit -projectPath $Project -executeMethod Jdi.Cli.Run -id DemoAllValid -logFile -
Jdi.Cli.Run -id <execution_config_id>.Jdi.Cli.Run -ec <asset_path>.Jdi.Cli.Run -c <asset_path>.Jdi.Cli.Run -all.--preview to -c or -all.--apply to -c or -all, or set executionMode = Apply in ImportBatchExecutionConfig.--reportJson=<path>.--reportText=<path>.