AssetsTools.NET icon indicating copy to clipboard operation
AssetsTools.NET copied to clipboard

Crash reading Bundle

Open johnwhile opened this issue 4 years ago • 7 comments

Hi, i'm trying to read a bundle file from a game but the code crash at:

        public string GetFileName(int index)
        {
            if (bundleHeader3 != null)
                return assetsLists3.entries[index].name;

            if (bundleHeader6 != null)
                return bundleInf6.dirInf[index].name;

            return null;
        }

with NullExeption for "bundleInf6.dirInf"

var am = new AssetsManager();
var bun = am.LoadBundleFile("shape");
//load first asset from bundle
var assetInst = am.LoadAssetsFileFromBundle(bun, 0, true);

ths file "shape" without extension start with bytes: "UnityFS 5.x.x 2021.1.17f1". It contains a list of fbx files that I have already extracted with the AssetStudioGui program but I would like to manage the extraction in my tool.

johnwhile avatar Nov 20 '21 13:11 johnwhile

I don't know what would cause this to happen unless the file was still compressed (by default, the bundle is decompressed, so no idea.) It could be a new bundle format for 2021.1, but I would expect a different error than that. Could you double check that bun.file.bundleHeader6.GetCompressionType() is 0?

nesrak1 avatar Nov 20 '21 22:11 nesrak1

return 0. It crash when i set "UnpackIfPacked = false". If "true" it work.

johnwhile avatar Nov 21 '21 10:11 johnwhile

this is the file: https://drive.google.com/file/d/1i6T1wonmkDoNtSWppeyD4A0C1KDPKu2I/view?usp=sharing

But i don't understand how read all fbx's file inside this file. With AssetsView i see all the objects separated (mesh, texture, transforms, etc...)

johnwhile avatar Nov 21 '21 13:11 johnwhile

But i don't understand how read all fbx's file inside this file.

There are no fbx files in assets files, only assets like mesh and material. Tools like AssetStudio combine and convert these assets into fbx. AssetsTools doesn't have any extractors, so you can't do fbx conversion with this tool.

nesrak1 avatar Nov 21 '21 15:11 nesrak1

ah ok,Is there any documentation about use assets objects ?

Il giorno dom 21 nov 2021 alle ore 16:30 nesrak1 @.***> ha scritto:

But i don't understand how read all fbx's file inside this file.

There are no fbx files in assets files, only assets like mesh and material. Tools like AssetStudio combine and convert these assets into fbx. AssetsTools doesn't have any extractors, so you can't do fbx conversion with this tool.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nesrak1/AssetsTools.NET/issues/58#issuecomment-974838240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3PE6VY6Q32NFR3O575MTUNEGDFANCNFSM5IN7MSMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnwhile avatar Nov 21 '21 19:11 johnwhile

Sorry if I'm bothering you :)

i get "file.bundleHeader6.GetCompressionType() = 3 so as you write in" OpenBundleDialog.DecompressBundle" i correctly create the *.unpacked file.

In the GameObject viewer i open this file and I see exactly what I need, the hierarchy of objects that make the fbx file. But i don't understand how read these data and how the relation work. I need to understand the "m_Father" and "m_Children" properties ?

Il giorno dom 21 nov 2021 alle ore 20:07 Jonathan @.***> ha scritto:

ah ok,Is there any documentation about use assets objects ?

Il giorno dom 21 nov 2021 alle ore 16:30 nesrak1 @.***> ha scritto:

But i don't understand how read all fbx's file inside this file.

There are no fbx files in assets files, only assets like mesh and material. Tools like AssetStudio combine and convert these assets into fbx. AssetsTools doesn't have any extractors, so you can't do fbx conversion with this tool.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nesrak1/AssetsTools.NET/issues/58#issuecomment-974838240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3PE6VY6Q32NFR3O575MTUNEGDFANCNFSM5IN7MSMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnwhile avatar Nov 21 '21 20:11 johnwhile

ok, i'm following the code and i think i start to understand something, but it is really complicated the file structure....

Il giorno dom 21 nov 2021 alle ore 21:04 Jonathan @.***> ha scritto:

Sorry if I'm bothering you :)

i get "file.bundleHeader6.GetCompressionType() = 3 so as you write in" OpenBundleDialog.DecompressBundle" i correctly create the *.unpacked file.

In the GameObject viewer i open this file and I see exactly what I need, the hierarchy of objects that make the fbx file. But i don't understand how read these data and how the relation work. I need to understand the "m_Father" and "m_Children" properties ?

Il giorno dom 21 nov 2021 alle ore 20:07 Jonathan @.***> ha scritto:

ah ok,Is there any documentation about use assets objects ?

Il giorno dom 21 nov 2021 alle ore 16:30 nesrak1 < @.***> ha scritto:

But i don't understand how read all fbx's file inside this file.

There are no fbx files in assets files, only assets like mesh and material. Tools like AssetStudio combine and convert these assets into fbx. AssetsTools doesn't have any extractors, so you can't do fbx conversion with this tool.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nesrak1/AssetsTools.NET/issues/58#issuecomment-974838240, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3PE6VY6Q32NFR3O575MTUNEGDFANCNFSM5IN7MSMA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnwhile avatar Nov 21 '21 20:11 johnwhile