UnityPackageArchiver is a PowerShell module that allows you to compress and expand .unitypackage format without using Unity.
It works on ubuntu, windows and macos. Also useful for CI/CD.
- PowerShell 6 or newer
- tar command
Run the following command in PowerShell.
$ Install-Module -Name UnityPackageArchiverSample code is available here.
You can extract a .unitypackage by running the following command.
$ Expand-UnityPackage -UnityPackagePath "./path/to/package.unitypackage" -OutputDir "./output/directory"You can compress files into a .unitypackage by running the following command.
$ Compress-UnityPackage -OutputFilePath "./path/to/output.unitypackage" -TargetFiles "./path/to/Assets/MyAsset.prefab", "./path/to/Assets/MyScript.cs"List the files under the Assets directory that you want to include in the TargetFiles argument. Note that .meta files will be ignored even if specified.
Also, preview.png is not supported. preview.png is the thumbnail displayed on the Asset Store website. There are no practical problems with this.
name: Sample
on: workflow_dispatch
jobs:
sample:
name: Sample
runs-on: ubuntu-latest
steps:
# for checkout Sample Data
- name: check out
uses: actions/checkout@v4
- name: Use Expand-UnityPackage
uses: hanachiru/UnityPackageArchiver/Expand-UnityPackage@main
with:
unity-package-path: "./Tests/Data/Expand/Input/sample.unitypackage"
output-dir: "./Tests/Data/Expand/Output"
- name: Use Compress-UnityPackage
uses: hanachiru/UnityPackageArchiver/Compress-UnityPackage@main
with:
output-file-path: "./Tests/Data/Compress/Output/Sample.unitypackage"
target-files: "./Tests/Data/Compress/Input/Assets/Prefabs/GameObject.prefab, ./Tests/Data/Compress/Input/Assets/Scenes/SampleScene.unity, ./Tests/Data/Compress/Input/Assets/Scripts/Sample.cs, ./Tests/Data/Compress/Input/Assets/Scripts/Editor/SampleEditor.cs, ./Tests/Data/Compress/Input/Assets/Sprites/logo.png, ./Tests/Data/Compress/Input/Assets/Sprites/note.pdf"Sample code is available here.
