Skip to content

Instantly share code, notes, and snippets.

@rgson
Last active December 27, 2020 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgson/6f4c1ff6855878c38d593a6c50518a4b to your computer and use it in GitHub Desktop.
Save rgson/6f4c1ff6855878c38d593a6c50518a4b to your computer and use it in GitHub Desktop.
Unpack .unitypackage files
#!/bin/sh
set -e
if [ -z "$1" ]; then
echo "Usage: $0 FILE.unitypackage" >&2
exit 1
fi
tmp=$(mktemp -d)
tar -C "$tmp" -x -f "$1"
out=$(basename -s .unitypackage "$1")
mkdir "$out"
for a in "$tmp"/*; do
[ -e "$a/pathname" -a -e "$a/asset" ] || continue
p=$(cat "$a/pathname")
mkdir -p "$out/$(dirname "$p")"
mv "$a/asset" "$out/$p"
done
rm -r "$tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment