Skip to content

hanachiru/UnityPackageArchiver

Repository files navigation

UnityPackageArchiver

日本語

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.

20250212110228

Table of Contents

Requirements

  • PowerShell 6 or newer
  • tar command

Installation

Run the following command in PowerShell.

$ Install-Module -Name UnityPackageArchiver

Usage

Basic Usage

Sample code is available here.

Extract

You can extract a .unitypackage by running the following command.

$ Expand-UnityPackage -UnityPackagePath "./path/to/package.unitypackage" -OutputDir "./output/directory"

Compress

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.

CI/CD

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.

About

PowerShell module for compressing and expanding .unitypackage

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •