A high-performance CLI tool to export a Unity project or directory into a .unitypackage file.
- Fast Export: Utilizes parallel processing and optimized I/O to quickly pack assets.
- Dependency Analysis: Automatically finds and includes dependent assets (scripts, materials, prefabs) to ensure your package works out of the box.
- Customizable: Options for including/excluding files via glob patterns.
Run the tool using the dotnet CLI. You can use the --help command to see all available options.
dotnet UnityPackageExporter.dll --helpDescription:
Packs the assets in a Unity Project
Usage:
UnityPackageExporter <source> <output> [options]
Arguments:
<source> Unity Project Directory.
<output> Output .unitypackage file
Options:
-a, --assets <assets> Adds an asset to the pack. Supports glob matching. [default: **.*]
-e, --exclude <exclude> Excludes an asset from the pack. Supports glob matching. [default:
Library/**.*|**/.*]
--skip-dependency-check Skips dependency analysis. Disabling this feature may result in missing
assets in your packages. [default: False]
-r, --asset-root <asset-root> Sets the root directory for the assets. Used in dependency analysis to only
check files that could be potentially included. [default: Assets]
-v, --log-level, --verbose <log-level> Sets the logging level (Trace, Debug, Information, Warning, Error, Critical) [default: Trace]
--version Show version information
-?, -h, --help Show help and usage information
dotnet UnityPackageExporter.dll "Projects/MyGame" package.unitypackage --assets "Assets/MyAsset/**.*" --skip-dependency-checkBelow is a GitHub action for packaging a Unity Package styled project (no Assets folder).
jobs:
env:
package_path: "~/my-package.unitypackage"
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v2
# Install the packager. We are putting it outside the working directory so we dont include it by mistake
- name: Install Unity Packager
run: |
git clone https://github.com/Guardingpearsoftware/public-unity-package-exporter.git "../tools/unity-package-exporter"
dotnet publish -c Release -o ../tools "../tools/unity-package-exporter/UnityPackageExporter"
# Pack the assets
- name: Package Project
run: |
echo "Creating package ${{env.package_path}}"
dotnet ../tools/UnityPackageExporter.dll ./ ${{env.package_path}} --exclude ".*" --exclude "Documentation"
# Upload artifact
- name: Upload Artifact
uses: actions/upload-artifact@v3.0.0
with:
name: Unity Package
path: ${{env.package_path}} NOTE: We perform a publish and then run the DLL to avoid known issues with running projects directly.
This package builder requires the .meta files generated by Unity to properly pack assets. If you ignore .meta files in your .gitignore, this tool may fail to link assets correctly, leading to broken packages. Ensure .meta files are committed to your repository.
This tool automatically scans selected assets for dependencies. While optimized with parallel processing, deep dependency analysis on large projects can still take time.
- Use the
--skip-dependency-checkflag to skip this step if you are manually ensuring all assets are included via glob patterns. - The
--asset-rootflag determines the starting folder for dependency scanning. By default, this is theAssetsfolder. For large projects or specific Package projects, setting this to a more specific directory limits the scan scope and significantly improves performance.
The exclusion rules still apply to assets found via dependency analysis.
This project is a fork of Lachee/Unity-Package-Exporter. It has been modernized to run on .NET 8, optimized with parallel processing and asynchronous I/O for faster exports.
A huge thank you to Lachee for the original implementation!