Continuous integration
Run the scan in a build pipeline, commit a baseline of the legacy input uses you accept, and fail the build when someone adds a new one.
Documentation pages
Input Porter is coming soon to the Unity Asset Store. This guide describes the release being prepared.
The scan runs in batch mode, so a build pipeline can run it too. It only reads the project, the same as in the editor. With a baseline, it becomes a gate: after you migrate, or while a migration is under way, the build fails as soon as someone adds new legacy input code.
1. Write a baseline
Run this once, on a machine with the project checked out:
Unity -batchmode -quit -projectPath <project> \
-executeMethod StackBlender.InputPorter.Editor.Analysis.LegacyInputScan.RunFromCommandLine \
-inputPorterReport <somewhere>/scan.json \
-inputPorterWriteBaseline <project>/InputPorterBaseline.json
Then commit InputPorterBaseline.json. It lists every legacy input use the project has now:
- reads in code;
- DLLs that call legacy input;
- legacy UI input modules in scenes and prefabs;
- code that adds such a module.
Put it at the project’s root, beside Assets, or anywhere else in your repository. It may
not go inside Assets, Packages, ProjectSettings, Library, or Temp. Neither may the
reports.
2. Check every build against it
Unity -batchmode -quit -projectPath <project> \
-executeMethod StackBlender.InputPorter.Editor.Analysis.LegacyInputScan.RunFromCommandLine \
-inputPorterReport <build-output>/input-scan.json \
-inputPorterBaseline <project>/InputPorterBaseline.json
| Exit code | Meaning |
|---|---|
| 0 | Nothing new: every legacy input use is in the baseline |
| 1 | New legacy input uses. The log lists them after INPUT_PORTER_NEW_LEGACY_USES, and the report names them |
| 2 | The check could not run: a missing argument, a baseline that is missing or unreadable, or a path inside the project |
A use is matched by where it is (file, class, and method) and what it reads, not by its
line number, so editing a file above a use does not make it new. Several identical reads in
one method are counted: a third Input.GetAxis("Horizontal") where the baseline has two is
new. Uses you migrate drop out, and the report counts them as resolved.
If the project does not compile, Unity stops batch mode itself (“Scripts have compiler errors”, exit code 1) before the scan runs, and no report is written. So an exit code of 1 with no report means a compile error, not new legacy input.
Accepting a new use on purpose
Write the baseline again (step 1) and commit it with the change. The diff of
InputPorterBaseline.json shows exactly what was accepted.
The reports
The JSON report and its Markdown twin, written beside it, are the same report the editor
shows under Tools > StackBlender > Input Porter > Scan Report. With a baseline they gain a
“Compared with the baseline” section. Their formats are described by
Documentation~/scan-report.schema.json and Documentation~/scan-baseline.schema.json in
the package (JSON Schema). Within version 1, fields may be added but are never renamed or
removed.