Jump to content
DerPopo

Unity Assets Bundle Extractor

Recommended Posts

I don't really understand how this tool work. I used it some while a12 or something and managed to replace a terrain texture with some flaws. The shader did not work on it. Now I have forgot how the tool works or there have been some changes somewhere.

 

Soo I does anyone know how to add or replace a terrain texture? And would be kind to explain how.

 

The textures are in the BlockTextureAtlases and TerrainTextures bundles. As always, create a backup of the original file. Extract the .assets file out of the bundle (the .assets file table first has to be decompressed), open it, select the texture to change, press Plugins and select Edit, Import, OK, and press File->Save in the asset list and save to another file name. Then open the decompressed bundle, import the new .assets file and save the bundle file which can then be used for the game.

I'll probably improve this so the .assets file can also be changed in the bundle without extracting it first. Maybe I'll also remove the need to save a decompressed copy first.

 

I second this. Thank you for this tool, Popo.

One minor suggestion: the search function could be improved. As it is now it only searches for the exact word and not for files containing the word.

 

Putting a * before and after the name includes all file names containing the query.

 

DerPopo, is there any chance that those of modding under Linux could get source code, or at least a Mono build?

 

I might look into porting the window code from Win32 to X11, which basically is the platform-dependant part of the code (and maybe some differences between VC++ and g++).

The tool also works good with Wine but native support would still be better of course.

Share this post


Link to post
Share on other sites

Putting a * before and after the name includes all file names containing the query.

Thanks, good to know. I was actually using another program to search the files (Unity Assets Explorer) and then went back to your program.

Share this post


Link to post
Share on other sites

Putting a * before and after the name includes all file names containing the query.

.....AAAA!!!!....:D

 

Tools #1 for me ! :)

Share this post


Link to post
Share on other sites
The textures are in the BlockTextureAtlases and TerrainTextures bundles. As always, create a backup of the original file. Extract the .assets file out of the bundle (the .assets file table first has to be decompressed), open it, select the texture to change, press Plugins and select Edit, Import, OK, and press File->Save in the asset list and save to another file name. Then open the decompressed bundle, import the new .assets file and save the bundle file which can then be used for the game.

I'll probably improve this so the .assets file can also be changed in the bundle without extracting it first. Maybe I'll also remove the need to save a decompressed copy first.

 

Yeah I got it to work!

Many thanks DerPopo, both for your fantastic tool and your help!

Share this post


Link to post
Share on other sites

@DerPopo,

I have another question. Is there a limit to how many textures in the resources.ASSETS can be changed at a time with UABE? E.g. if I change 10 textures at a time not all of them will be changed.

 

Thanks again for your tool!

Share this post


Link to post
Share on other sites

Okay so I'm new to this and I've clearly no idea what I'm doing after messing with this for a bit. How do I even run it?

Share this post


Link to post
Share on other sites

Hello DerPopo !

 

I often use your Utility - it is very important to me !

 

Because of this - suggestions for improvement.

I think these are not complicated changes would much easier to make it to use.

 

- search... - i've been told that you need to put "*" ...before I thought it was just broken. And need Hot Key.

- window after loading asset there is a very small, i have every time to make it resize bigger.

 

I think that monitors with a resolution of 800x600 are no longer used, and if anyone works for them - the better that they suffer and not those who have a large monitor :D

 

Do not think for insolence. With Respect ! :)

Again, Thank You so much for this Tool !

Share this post


Link to post
Share on other sites

where's the API documents ?

 

It always return false when I use AssetsBundleFile.Read to read assetbundle file.

It just tell me "AssetsBundleHeader06: A file read error occured!"

 

Hmmmm... I just AssetsBundleFile.Read after open the assetbundle file.

 

FILE * file = NULL;

_wfopen_s(&file, L"The path to assetbundle file", L"rb");

AssetsBundleFile assetsBundle;

assetsBundle.Read(AssetsReaderFromFile, (LPARAM)file);

 

 

is something wrong?

 

TKS for help:adoration:

Edited by sam ata (see edit history)

Share this post


Link to post
Share on other sites
Hello DerPopo !

 

I often use your Utility - it is very important to me !

 

Because of this - suggestions for improvement.

I think these are not complicated changes would much easier to make it to use.

 

- search... - i've been told that you need to put "*" ...before I thought it was just broken. And need Hot Key.

- window after loading asset there is a very small, i have every time to make it resize bigger.

 

I think that monitors with a resolution of 800x600 are no longer used, and if anyone works for them - the better that they suffer and not those who have a large monitor :D

 

Do not think for insolence. With Respect ! :)

Again, Thank You so much for this Tool !

Thanks! I will look into improving the search. As for the window, I might make it save the previous size so it's easier to keep the "ideal" size.

 

where's the API documents ?

 

It always return false when I use AssetsBundleFile.Read to read assetbundle file.

It just tell me "AssetsBundleHeader06: A file read error occured!"

 

Hmmmm... I just AssetsBundleFile.Read after open the assetbundle file.

 

is something wrong?

 

TKS for help:adoration:

 

It looks like either the file wasn't opened properly OR the compiler versions don't match (i.e. you need VC++ 2010 and compile in Release mode so functions taking standard C/C++ library parameters such as FILE or std::vector work properly).

 

_____

 

For the next release, I am working on a mod creator similar to the one in grim's UAE that allows to capture modifications to .assets and to bundles and export them to a standalone .exe installer. Because I had to do some background work for it, .assets in bundles also can be modified directly without exporting them first.

I'll also improve Unity 4.x support by adding more asset type information (4.0.0f7 and 4.7.2f1 is done so far) and making the asset type plugins compatible to it.

Edited by DerPopo (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites
Thanks! I will look into improving the search. As for the window, I might make it save the previous size so it's easier to keep the "ideal" size.

 

 

 

It looks like either the file wasn't opened properly OR the compiler versions don't match (i.e. you need VC++ 2010 and compile in Release mode so functions taking standard C/C++ library parameters such as FILE or std::vector work properly).

 

_____

 

For the next release, I am working on a mod creator similar to the one in grim's UAE that allows to capture modifications to .assets and to bundles and export them to a standalone .exe installer. Because I had to do some background work for it, .assets in bundles also can be modified directly without exporting them first.

I'll also improve Unity 4.x support by adding more asset type information (4.0.0f7 and 4.7.2f1 is done so far) and making the asset type plugins compatible to it.

 

It work now! Thank you very much!

 

There is a few problems:

--How to extract assets file from assetsbundle file?

--How to get asset data just like Material from assets file ?

 

I can only unpack assetbundle file if compressed and get the asset name from AssetsFileTable.

Share this post


Link to post
Share on other sites
It work now! Thank you very much!

 

There is a few problems:

--How to extract assets file from assetsbundle file?

--How to get asset data just like Material from assets file ?

 

I can only unpack assetbundle file if compressed and get the asset name from AssetsFileTable.

 

Open the uncompressed File and you should see a list of all the assets. Look for the data you want (e.g. a texture) and select it. Then click on "Plugins" and you should get a list of export options.

Share this post


Link to post
Share on other sites

I now have a problem myself and I'm not sure what I'm doing wrong...

 

I have a compressed assets file. I was able to decompress it and then export it. I re-open it and can export a texture, change it, and re-import it with "Edit".... BUT... I can't recompress the asset file and therefore can't use it.

 

I tried this with a mod (just to see if I get the process right) and noticed that the mod does not work with the uncompressed asset file, even if I don't change anything at all in it.

 

I'm sure I'm doing something simple wrong.... but what? ;)

Share this post


Link to post
Share on other sites

I also can not get to work on the unpacked file, I edited BlockTextureAtlases and TerrainTextures...maybe protection? But no problem with primary assets in folder 7DaysToDie_Data.

Share this post


Link to post
Share on other sites

Reimport the .assets file to the unpacked bundle file and save the modified bundle file.

The bundle file basically contains one/multiple .assets file/s and in some cases additional data. If a Unity game reads a bundle file, it won't accept an .assets file.

 

It work now! Thank you very much!

 

There is a few problems:

--How to extract assets file from assetsbundle file?

--How to get asset data just like Material from assets file ?

 

I can only unpack assetbundle file if compressed and get the asset name from AssetsFileTable.

For the first thing, you need to call AssetsBundleFile::MakeAssetsFileReader.

If bundleHeader3.fileVersion is 3, you need to specify one entry of count entries in assetsLists3->ppEntries.

If bundleHeader3.fileVersion is 6, you need to specify the reference to one entry of directoryCount entries in bundleInf6->dirInf.

MakeAssetsFileReader returns an AssetsFileReader function. Pass the original reader (usually AssetsReaderFromFile), the pointer to a reader parameter (usually (LPARAM)pFile) that will be updated on success and the entry pointer as I mentioned above.

The entry also contains the file size, which you'll probably need. You can use the reader and the reader parameter to read the data to a memory buffer and write this data to a file. The data you want starts at position 0.

 

For the second thing, you can create an AssetsFileTable. The constructor takes a pointer to the AssetsFile and a bool whether names should be read from every single asset (it does lots of random access so it's much slower if true). Then either call one of the getAssetInfo functions or manually go through the pAssetFileInfo list (assetFileInfoCount entries). The AssetFileInfoEx structure contains the absolute position (in the reader you passed to the AssetsFile) and the size (curFileSize).

 

The API can't directly read compressed bundles. If it's compressed, it only reads the header and you have to use the Unpack function for the rest.

Edited by DerPopo (see edit history)

Share this post


Link to post
Share on other sites
Reimport the .assets file to the unpacked bundle file and save the modified bundle file.

The bundle file basically contains one/multiple .assets file/s and in some cases additional data. If a Unity game reads a bundle file, it won't accept an .assets file.

 

 

For the first thing, you need to call AssetsBundleFile::MakeAssetsFileReader.

If bundleHeader3.fileVersion is 3, you need to specify one entry of count entries in assetsLists3->ppEntries.

If bundleHeader3.fileVersion is 6, you need to specify the reference to one entry of directoryCount entries in bundleInf6->dirInf.

MakeAssetsFileReader returns an AssetsFileReader function. Pass the original reader (usually AssetsReaderFromFile), the pointer to a reader parameter (usually (LPARAM)pFile) that will be updated on success and the entry pointer as I mentioned above.

The entry also contains the file size, which you'll probably need. You can use the reader and the reader parameter to read the data to a memory buffer and write this data to a file. The data you want starts at position 0.

 

For the second thing, you can create an AssetsFileTable. The constructor takes a pointer to the AssetsFile and a bool whether names should be read from every single asset (it does lots of random access so it's much slower if true). Then either call one of the getAssetInfo functions or manually go through the pAssetFileInfo list (assetFileInfoCount entries). The AssetFileInfoEx structure contains the absolute position (in the reader you passed to the AssetsFile) and the size (curFileSize).

 

The API can't directly read compressed bundles. If it's compressed, it only reads the header and you have to use the Unpack function for the rest.

 

:eagerness:Great!

I have extracted AssetsFile from AssetsBundle file successfully!

But, how to get the asset data(The "View Data" function do)?

The ClassDatabaseFile and the Type_07::classId maybe useful, but I don't known how to use them.

Share this post


Link to post
Share on other sites
Reimport the .assets file to the unpacked bundle file and save the modified bundle file.

 

That's what I don't get... When I open the packed bundle it automatically asks me if I want to unpack it.. if I do, I have to give it a file name and get the bundle unpacked. When I then import the changed assets file and save it, it's no longer packed (and therefore bigger).

 

If I don't unpack it, nothing happens and I don't have an open file I can import to or save again.

 

? :(

Share this post


Link to post
Share on other sites

I am a complete noob when it comes to this kind of stuff and was wondering if someone could help me.

 

I am trying to play a game that was made in Unity, but the game has no setting for mouse sensitivity and the windows mouse speed setting has no affect on the game.

 

I downloaded Unity Personal and then realized I cannot edit the game files. Is the mouse sensitivity something that I would be able to change through an assets file and would I be able to use this program to accomplish this? I already downloaded it and started looking through the assets files, but I really don't know what I am looking for or how to edit the file if I find the correct one.

Edited by AllTracTurbo (see edit history)

Share this post


Link to post
Share on other sites
:eagerness:Great!

I have extracted AssetsFile from AssetsBundle file successfully!

But, how to get the asset data(The "View Data" function do)?

The ClassDatabaseFile and the Type_07::classId maybe useful, but I don't known how to use them.

 

UABE has a ClassDatabasePackage file (classdata.tpk) that consists of several ClassDatabaseFiles, each for one Unity version. You could either create a ClassDatabasePackage instance, load the .tpk file and pick one of the header.fileCount ClassDatabaseFiles or directly open a database file (you can export them from within UABE). Select the ClassDatabaseType you need, create an AssetTypeTemplateField (AssetTypeClass.h) and call FromClassDatabase with fieldIndex 0. With the template base field, you can create an AssetTypeInstance with baseFieldCount = 1, ppBaseFields as a 1-item array of template fields and the reader to the asset. With it, you can recursively go through the fields and their values. In case you want the deserialized asset data of e.g. an AudioClip with a byte array, change the template field type of this array (the child of m_AudioData usually named "array") to "TypelessData" so it doesn't create a value field plus value struct for every single byte.

In case the .assets or the bundle file contains the type data, you can also use AssetTypeTemplateField::From07 or From0D.

 

 

 

That's what I don't get... When I open the packed bundle it automatically asks me if I want to unpack it.. if I do, I have to give it a file name and get the bundle unpacked. When I then import the changed assets file and save it, it's no longer packed (and therefore bigger).

 

If I don't unpack it, nothing happens and I don't have an open file I can import to or save again.

 

? :(

 

Most often, compressed Unity 5.3+ bundle files (except for web builds) only have a compressed file table, which is small anyway. UABE currently can't directly read compressed files and has to work with a decompressed one. Therefore, it won't open files that aren't decompressed.

The decompressed and modified files can also be used within the game (except if a bug breaks them).

 

I am a complete noob when it comes to this kind of stuff and was wondering if someone could help me.

 

I am trying to play a game that was made in Unity, but the game has no setting for mouse sensitivity and the windows mouse speed setting has no affect on the game.

 

I downloaded Unity Personal and then realized I cannot edit the game files. Is the mouse sensitivity something that I would be able to change through an assets file and would I be able to use this program to accomplish this? I already downloaded it and started looking through the assets files, but I really don't know what I am looking for or how to edit the file if I find the correct one.

 

Take a look at the InputManager in the asset list. Export a dump of it, change the sensitivity, import the changed dump and save the .assets file. I didn't test it myself though.

Share this post


Link to post
Share on other sites
Take a look at the InputManager in the asset list. Export a dump of it, change the sensitivity, import the changed dump and save the .assets file. I didn't test it myself though.

I got it to work. Thanks for your help and for making this great tool.

Share this post


Link to post
Share on other sites
UABE has a ClassDatabasePackage file (classdata.tpk) that consists of several ClassDatabaseFiles, each for one Unity version. You could either create a ClassDatabasePackage instance, load the .tpk file and pick one of the header.fileCount ClassDatabaseFiles or directly open a database file (you can export them from within UABE). Select the ClassDatabaseType you need, create an AssetTypeTemplateField (AssetTypeClass.h) and call FromClassDatabase with fieldIndex 0. With the template base field, you can create an AssetTypeInstance with baseFieldCount = 1, ppBaseFields as a 1-item array of template fields and the reader to the asset. With it, you can recursively go through the fields and their values. In case you want the deserialized asset data of e.g. an AudioClip with a byte array, change the template field type of this array (the child of m_AudioData usually named "array") to "TypelessData" so it doesn't create a value field plus value struct for every single byte.

In case the .assets or the bundle file contains the type data, you can also use AssetTypeTemplateField::From07 or From0D.

 

I can not find the ClassDatabasePackage from .h files.

Share this post


Link to post
Share on other sites

Looks like it isn't in the headers yet. Export a class database file from the package using UABE and open it through ClassDatabaseFile::Read.

Share this post


Link to post
Share on other sites

Documentation of API

 

It allows you to develop tools which read/write .assets and bundle files using AssetsTools.dll . It doesn't contain UABE itself.

 

 

Hello DerPopo, First grats is a great work this, very helpful. I wonder if you have any documentation about how to use the API to read/write assets?.

 

Another Question, in which lenguage are you development this tool is C++? I'm working on something similar but I want display the info directly in the Unity Editor and only I'm trying to get the Size of each component in the assetBundle.

 

For your program I guess the first step is decompress the bundle if this is not, after look into the serialized file, get all the components and finally process each one into right Type of Component to get all the properties, Am I right? At least this is how I'm thinking to aboard this.

 

Again an impressive work, cheers, and any comment if I'm going in the right way will be appreciated.

 

P.S If you can indicate me how to use your API thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...