Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to read asset bundle #136

Open
gonsodany opened this issue Oct 9, 2024 · 3 comments
Open

Trying to read asset bundle #136

gonsodany opened this issue Oct 9, 2024 · 3 comments

Comments

@gonsodany
Copy link

Im trying to modify an asset bundle, what im trying to do is modify some parameters on an animator controller of the asset bundle, i've been trying for 2 days to so much as read the asset bundle but nothing on the examples/documentation works

using the "Read Asset bundles" example but the code doesnt work

"var manager = new AssetsManager();

// Load the bundle file
var bunInst = manager.LoadBundleFile(assetURL, true);
foreach (var asset in bunInst.file.GetAllFileNames())
{

}
var afileInst = manager.LoadAssetsFileFromBundle(bunInst, 0, false);
var afile = afileInst.file;

// Loop through the textures and log their names and dimensions
foreach (var texInfo in afile.GetAssetsOfType(AssetClassID.Texture2D))
{
var texBase = manager.GetBaseField(afileInst, texInfo);
var name = texBase["m_Name"].AsString;
var width = texBase["m_Width"].AsInt;
var height = texBase["m_Height"].AsInt;

Debug.Log($"Texture {name} is sized {width}x{height}");

}"

image
image
image
these methods dont exist

@gonsodany
Copy link
Author

doing "var afileInst = manager.LoadAssetsFileFromBundle(bunInst, 0, false);" always just gives me the error "ArgumentNullException: Value cannot be null.
Parameter name: path2
System.IO.Path.Combine (System.String path1, System.String path2) (at <27124aa0e30a41659b903b822b959bc7>:0)
AssetsTools.NET.Extra.AssetsManager.LoadAssetsFileFromBundle (AssetsTools.NET.Extra.BundleFileInstance bunInst, System.Int32 index, System.Boolean loadDeps) (at C:/Users/nesquack/Documents/GitReposLocal/AssetsTools.NET/AssetTools.NET/Extra/AssetsManager/AssetsManager.cs:170)" too

@nesrak1
Copy link
Owner

nesrak1 commented Oct 10, 2024

Where did you get AssetsTools.NET from? The github releases page is out of date, so you should get it from nuget if you didn't already. The method you said is missing is there:

@gonsodany
Copy link
Author

I got it from github, which would make sense the missing/outdated methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants