Hi,
I want to use a xml file from a unitypackage file .But I don’t want to use the unity to extract the unitypackage file.Is there another way to extract unitypackage file?
Thanks in advance!
I made a simple Python library that will do this because all of the projects linked seemed to be broken.
It’s true that a .unitypackage is just a .tar.gz, but it also has an internal structure whereby there are folders that each hold multiple pieces representing one file. The above Python script will extract the entire .unitypackage
as normal files.
Not sure if it works, but here is a supposed option : http://forum.unity3d.com/threads/180080-Released-Open-Source-unitypackage-extractor-from-cmd-line
It’s also worth pointing out that they’re actually just .tar.gz files, so if you rename them you can extract the contents with familiar software too or build them yourself if needed. (They contain a bunch of folders, each of which contains a file called ‘asset’ which is the actual asset data, alongside various bits of meta and a file containing the original path).
As @KulestarUK pointed out, .unitypackage
files are indeed .tar.gz
files
You can list the files like this:
tar -ztvf GooglePlayGamesPlugin-0.9.34.unitypackage
…
./01dde458421cf400394d2f715db9e194/asset
./01dde458421cf400394d2f715db9e194/asset.meta
./01dde458421cf400394d2f715db9e194/pathname
./00e67e97029f64d44904d85583893fe9/asset
./00e67e97029f64d44904d85583893fe9/asset.meta
./00e67e97029f64d44904d85583893fe9/pathname
./00e08ce5b0e2044329c76dcf32fcec96/asset
./00e08ce5b0e2044329c76dcf32fcec96/asset.meta
./00e08ce5b0e2044329c76dcf32fcec96/pathname
Sadly, it’s a bit sad and not very verboze. I didn’t need to actually extract these files, but I wanted a clear text list of all the files that would be added (So I can easily uninstall a package).
From above output, hard to quickly and easily get a clear text list of the files without reading all of the pathname
files. After some command line fu, I managed to write the following command:
tar -axf GooglePlayGamesPlugin-0.9.34.unitypackage --wildcards --no-anchored '*pathname*' --to-command="echo '' && cat"
It basically extract files that has pathname
in their name, read them and pass them to echo '' && cat
which prints a newline and read the file.
Output looks like this:
…
Assets/GooglePlayGames/Platforms/IOS
Assets/Plugins/iOS/GPGSAppController.mm
Assets/GooglePlayGames/Platforms/Native/PInvoke/BaseReferenceHolder.cs
Assets/GooglePlayGames/Platforms/Native/NativeQuestClient.cs
Assets/GooglePlayGames/Platforms/Native/ConversionUtils.cs
If this sounds like black magic, please read The art of command line on Github and start changing your life <3
As @sharp911 mentionned, you may also give bradgearon/unity-3d-package-extract a try
There is no way to read the contents of a unitypackage file outside the editor. But if you just want to avoid filling a bunch of unnecessary code and assets from a unitypackage file into your main project, just do this:
Start a new project and import the unitypackage file into this. It’ll extract itself and populate that project’s Assets folder with all the files. Then copy paste the file you need from that project into the actual project. You can delete the temp project afterwards if you like.
You can use “Extract Unitypackage”, it is a batch extract .unitypackage tool, and it needn’t unity3d installed, the url is Free batch extract unitypackage files without Unity3d easily
This tool can do it: http://upu.derfunk.com/
If anyone is still facing this issue, I recently tried the [SamarthMP/unitypackage-extractor: A GUI and CLI Tool For Extracting UnityPackage Files], and it has worked wonderfully so far.
Thanks @Coburn37 !