DEV Community

Antonio Pavlinović
Antonio Pavlinović

Posted on • Originally published at critical.gg on

How to extract Assets from Unity APK

Introduction

How to extract Assets from Unity APK

These days, most Android, iOS and event Nintendo Switch games are built with Unity. As one would expect, Unity unified the development platform, allowing developers to (almost) build once and easily deploy at a variety of platforms.

Today, we're gonna show you how to extract icons, sprites, audio files, in-game models, text and other visual elements from a typical Unity application. For today's demonstration we'll be using Pokemon GO, as it's a very popular game written in Unity. The process is similar for every other Unity application, with a few tweaks here and there.


Prerequisites

This guide makes a few assumptions about your knowledge and tools. You will need the following to follow along with the guide:

  • Microsoft Windows , as most tools we're using are built for Windows. A decent computer is also recommended, as the extraction process can take some time, mostly depending on your hard drive and CPU speed.
  • An Android device (or a simulator) with X-Plore File Manager installed. This is "somewhat optional", but you will be limited to extracting assets only from APKs.
  • 7-zip or any other ZIP file extractor. Android apps are ZIP archives disguised as APK files. In order to inspect their content, you will need to extract them.

Step 1 - Downloading extraction tools

In order to start extracting, you will need at least one Unity Asset extraction tool. These tools will allow you to dump assets with ease and they don't require any coding skills.

There are two tools which we recommend using:

  • Recommended: AssetStudio by Prefare, a GUI based tool that allows you to filter which type(s) of assets you want to export. Asset Studio is very straightforward and perfect for beginners.
  • Unity Asset Bundle Extractor is a lower level tool that can even manipulate Unity bundles. Useful for advanced data miners and readers who want to mess around with loading custom skins and color schemes.

Head over to Asset Studio's Releases section on Github and grab the latest release from there. Asset Studio doesn't require any installation. You can extract the downloaded ZIP file anywhere and start the Studio by opening AssetStudioGUI.exe:

How to extract Assets from Unity APK
Asset Studio GUI, nothing opened yet.

Step 2 - Getting and extracting the APK

APK files are packages used for distributing Android applications. APK files contain everything needed to start the application and they often contain a ton of visual assets. As mentioned before, we will be using Pokemon GO as a model Unity app in this tutorial

You can get the latest Pokemon GO APK in one of two ways:

  1. Download it from APK Mirror
  2. Extract it from your device by using APK Extractor

The easiest way is to download it from APK mirror. Grab the latest APK from APK Mirror, head over to your Downloads folder and open the APK with 7-Zip. Extract the contents into a sub-folder and navigate into it.

How to extract Assets from Unity APK
File contents of the Pokemon GO APK include various Android and Unity files. We are mostly interested in the assets folder. Future guides will target classes.dex and other hidden gems.

We could go on and on about the files and folders inside the APK, but let's focus on the task at hand: dumping assets.


Step 3 - Extracting the assets

TLDR

  1. Extract the ZIP somewhere
  2. Open Asset Studio and open the extracted folder
  3. Select types of assets you want to dump (filter them)
  4. Press Export > Filtered assets

We are now ready to explore and dump the assets. Switch over to Asset Studio and follow the instructions below:

  • Click File > Load Folder
  • Navigate to the folder where you extracted Pokemon GO
  • Select assets and click Select Folder
  • Let Asset Studio do it's magic

Once the process completes, you should see the following screen:

How to extract Assets from Unity APK
Asset Studio has finished parsing the folder and is now ready to export.

Switch over to the Asset List tab. These are all of the files you can export from the APK. As you can notice, some of them are Texture2D, some are sprites, some are TextAssets etc.

Before exporting select which files you want to dump. The easiest way to do that is to filter the Asset List by using the Filter Type dropdown from the menu bar. Open the Filter Type dropdown and select the following:

  • AudioClip
  • Sprite
  • TextAsset
  • Texture2D

In order to start the export process, click on the Export dropdown and select Filtered assets. Select a folder where you want to save the exported files. Let Asset Studio chew through your filtered files. The destination folder will automatically open when the process is done.

Here are the results we got, Sprite subfolder used as an example:

How to extract Assets from Unity APK
Sprites from Pokemon GO were dumped inside the /sprites subfolder. Textures, text assets and sounds were dumped in other subfolders.


Step 4 - Extracting from an Android device (optional, advanced) 🧙

In addition to extracting assets from an APK, you can extract Unity assets from the Android device where the APK was installed. This is especially useful for large games which don't ship with built-in assets, but rather download them on-the-fly. One of those games is Harry Potter: Wizards Unite.

Wizards Unite is built as a lightweight Unity shell that sets up player's account, loads the overworld map and renders some basic UI element. Upon encountering an enemy or opening a menu, the game will download and cache the required Unity assets. These assets are the same assets as you would normally get from the APK, but they are downloaded on demand.

This begs the question, if the assets are not in the APK, where are they?

The answer is simple: on your Android device. In order to find these assets we will use the aforementioned X-Plorer File Manager.

Warning: this part is going to be a little tricky at first, but it's gonna get easier once you get a hang of it. Follow the instructions closely, please. You will need a PC and the Android device for this to work.

Instructions for finding and Extracting Unity files from your Android device

  1. Put both of your devices (PC and your phone) on the same network (same WiFi or local network). They need to be in the same IP range for this to work.
  2. Launch X-Plorer and press "WiFi start". This will start a WiFi server on your phone and provide you with an IP address which can be used to explore your Android device from your PC.
  3. Launch a browser of your choice and navigate to the IP address on your PC. A desktop friendly version of the X-Plorer UI will open up and you can navigate through your device easily.
  4. In order to find app data, you need to navigate go to /sdcard/android/data and find your application's folder inside. For Wizards Unite, it's named com.nianticlabs.hpwu.prod.
  5. Right click on the folder and press Download as Zip. That's it.

How to extract Assets from Unity APK
Dumping cached Unity Assets from an Android device.

The download process can (and quite often will) fail, so you have to be patient and download the assets in chunks or simply try your luck enough times.

The steps to extract the assets are the same as with the APK:

  1. Extract the ZIP somewhere
  2. Open Asset Studio and open the extracted folder
  3. Select types of assets you want to dump
  4. Press Export > Filtered assets

Parting words

This guide covers the basics of dumping assets from Unity Games and apps. You can use this process for a wide variety of games and apps on mobile and the PC. Be aware that a growing number of Unity games uses Android's hidden partition for storing downloaded assets.

Dumping those assets requires rooting, and we will address those games in a future article, but for now, let's stick with the basics.

Good luck in your asset dumping adventures! 🤠 ⛏️

Top comments (0)