Perfare / AssetStudio

AssetStudio is a tool for exploring, extracting and exporting assets and assetbundles.
MIT License
13.38k stars 2.58k forks source link

.bytes file extracting as .txt #269

Closed alphadrive closed 6 years ago

alphadrive commented 6 years ago

I have multiple Unity files which the latest build of AssetStudio (v0.10.0.86 as of the time of writing this) is able to load and recognise as containing two exportable assets when "Display all assets" is enabled. One of the listed assets is listed as type "AssetBundle", while the remaining asset is recognised as a "TextAsset". Attempting to extract the TextAsset file will yield a .txt file with what appears to be serialized/binary data.

However, the serialized data of the AssetBundle asset actually seems to reference the TextAsset file as a ".bytes" file, which AssetStudio seems to be capable of recognising and decompressing into more assets when these were encountered with other games (at least when the .bytes file is actually another AssetBundle file itself). The .txt files that are extracted in this case don't seem like they can be read or recognised by AssetStudio as they don't contain the usual file headers attached to .unity3d and .assets files -- however, their filenames have me fairly convinced that they contain various game assets and multimedia files.

I've attached one of these Unity files which I'm fairly sure should contain some kind of sound file in the text/bytes asset (the text asset in this one has "BGM" in its path name). Please let me know if I should attach more samples to help with the issue, and I apologise if this is actually not a problem concerning AssetStudio itself.

https://mega.nz/#!jeRjGabC!6mHq4ONShxQO1hn-Nr1w94Ktk-QEjTgPYEW41E1dX2o

Perfare commented 6 years ago

The suffix name can't represent anything, because most of the TextAsset types in the asset are TXT files, so AssetStudio adds a .txt suffix to the export. If you think it is a .bytes file, why not rename it?

JuGGerNaunT commented 6 years ago

@alphadrive https://docs.unity3d.com/Manual/class-TextAsset.html

alphadrive commented 6 years ago

Thank you both for the replies and information.

Am I understanding correctly then that .bytes file normally don't come with a Unity header like the example in the attached image below then? I may have been completely misunderstanding the normal format and structure of .bytes files in that case.

image

From my first post, I did indeed try to rename the extracted "bgm_178bytes.txt" file to "bgm_178bytes.bytes", but AssetStudio was unable to read it since it doesn't contain any header unlike the one in the screenshot. With the .bytes file in the screenshot, AssetStudio loads it as if it was a .unity3d file.

I'll see if I can get Unity Editor to recognise bgm_178bytes.txt as binary audio data, but I'm not sure how to decode it for use outside of Unity. This does seem like it's not a problem with AssetStudio though, so I thank you both for taking the time to point me in the right direction.

JuGGerNaunT commented 6 years ago

TextAsset doesn't has any specific format. It is any file that developer put in Unity project and named .bytes, or .txt or *.json. It could be compressed image, binary data for AI, json for visualization items in shop or information about some structure. Anything that dev decided. It is called TextAsset because typically developers store text data in such files (e.g. localization)

mani901 commented 3 years ago

Screenshot (17) how to read this text asset