Unity returned exit 0 and installed nothing
What we hit
We were preparing an upload project for a headless Unity Asset Store workflow. We needed the Asset Store Publishing Tools installed in that project, and we wanted to do the installation without opening the Editor GUI.
We tried Unity in batchmode with -importPackage. The process returned exit 0. The log echoed the flag, but the project’s assets were unchanged. Nothing had been imported.
That combination was the incident: an operation that appeared successful at the process boundary had not produced the state we needed. We had a completed command, but we did not have an installation.
The distinction mattered because these tools were a prerequisite for the upload workflow. Our next steps needed the installed code, not merely evidence that Unity had accepted a command-line argument.
What we assumed
Our approach depended on the assumption that invoking the package importer in batchmode would install the package, and that a successful exit would correspond to a successful import.
The log did not establish that. It showed the flag, while the unchanged assets showed that the expected work had not happened. We could not use the echoed argument as evidence of installation.
Exit 0 was the dangerous part because it did not distinguish this no-op from a completed import. If we treated that status as sufficient proof, we would report a prerequisite as ready when it was still missing.
We recorded the behavior as an observed result. The source records do not establish why Unity skipped the import. We did not have a confirmed explanation for the importer’s behavior, and the fix did not depend on inventing one.
What was actually true
The package did not require the Editor to reconstruct its contents. A .unitypackage is a gzip-compressed tar archive. Its entries contain a destination pathname, asset contents, and asset metadata, grouped under GUID directories.
That gave us a way to perform the installation directly. We could read the archive and put its contents into the upload project ourselves.
There was still a boundary to this approach. The package download had to come from the Editor’s Package Manager once per machine. The downloaded archive remained available locally. Our script automated installation from that archive; it did not replace the download step.
This narrowed the job to something concrete: locate the downloaded package, reconstruct its files and folders in the project, preserve the metadata, and check that the expected package directory existed.
The fix
We implemented the installation in a shell script with embedded Python. The script checks that the source archive exists before attempting extraction. If it is missing, the script reports that the download is required and exits with a failure status.
The Python code opens the archive as gzip tar and extracts it into a temporary directory. It then walks the entries and reads the first line of each pathname record. Later lines are Unity bookkeeping, so they are not used as the destination.
Before copying an entry into the project, the script skips empty paths, absolute paths, and paths containing a parent-directory component. For an entry with asset contents, it creates the destination’s parent directories and copies the file. For a folder-only entry, it creates the directory. It also copies any accompanying asset metadata.
After copying, it removes the temporary directory and reports files written and unsafe paths skipped. The shell script then checks for the expected tools package directory. If that directory is absent, installation fails explicitly.
We also verified the resulting upload project with the real Editor. The handoff records that the tools were installed, compilation passed with them present, and tool operation was checked. That gave us evidence beyond the extraction script’s own completion.
The lesson
We learned to separate a successful process exit from a successful state change. In this incident, exit 0 accompanied an unchanged project, so we needed to inspect the installation and verify the resulting project before calling the work complete. We resolved the installation by extracting the documented archive structure ourselves, while leaving the importer’s unexplained behavior unconfirmed.
Root Cause is written while shipping small software products — you can see them at TechAthletes.