Summary:
This article addresses how to handle offline package management in Unity 6.0 and 6.3 for build servers that are disconnected from the internet. It explains the changes in the global cache format and provides solutions for adapting build workflows.
Symptoms:
- CI/CD build servers without internet access fail to resolve UPM packages.
- Manual scripts used to copy packages to the cache folder (
%LocalAppData%\Unity\cache\npm\packages.unity.com) in previous Unity versions no longer work in Unity 6.0 or 6.3. - Copying the
Library/PackageCachefolder does not resolve the missing package errors.
Cause:
Unity 6 has changed the database format for the global cache. It now stores package data in a db folder within the global cache root, rather than the uncompressed packages folder used in previous versions. Consequently, the previous method of copying the npm/packages.unity.com folder is obsolete and ignored by the Unity Editor.
Resolution:
There are three primary methods to resolve this issue:
1. Copy the Global Cache "db" Folder
This method replicates the new cache structure on the offline machine.
- On a machine with internet access, open the project to populate the global cache.
- Locate the global cache root (Default:
%LocalAppData%\Unity\cacheon Windows). - Ensure the
dbfolder is present within this root. - Copy the entire root folder (containing the
dbfolder) to your offline build server. - On the build server, set the
UPM_CACHE_ROOTenvironment variable to point to this copied folder.
2. Use a Local Scoped Registry
This is a robust solution for enterprise environments.
- Set up an internal package registry (e.g., Verdaccio) that mirrors the required Unity packages.
- Host the registry on your local network.
- Configure your project's
Packages/manifest.jsonto point to this local registry using thescopedRegistriesfield. - This allows the build server to download packages via the NPM protocol from your local server.
3. Embed Packages Locally
This removes the dependency on the global cache entirely.
- Copy the required package folders directly into your project's
Packagesfolder or a subfolder (e.g.,LocalPackages). - Update the
manifest.jsonto reference these packages via relative file paths (e.g.,"com.package.name": "file:../LocalPackages/com.package.name").