Skip to content

Error parsing 2021.3.16f1 bundle #166

Description

@ds5678

I encountered an exception while following directions at https://github.com/nesrak1/AssetsTools.NET/wiki/Getting-Started:-Bundle-file-reading

var manager = new AssetsManager();
manager.LoadClassPackage(Path.Join(AppContext.BaseDirectory, "uncompressed.tpk"));

var bunInst = manager.LoadBundleFile(filePath, true);
int fileCount = bunInst.file.BlockAndDirInfo.DirectoryInfos.Count;
for (int i = 0; i < fileCount; i++)
{
    if (!bunInst.file.IsAssetsFile(i))
    {
        continue;
    }
    var afileInst = manager.LoadAssetsFileFromBundle(bunInst, i, false);
    AssetsFile afile = afileInst.file;
    manager.LoadClassDatabaseFromPackage(afile.Metadata.UnityVersion);
    foreach (var shader in afile.GetAssetsOfType(AssetClassID.Shader))
    {
    }
}
Unhandled exception. System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'capacity')
   at AssetsTools.NET.AssetsFileMetadata.Read(AssetsFileReader reader, UInt32 version)
   at AssetsTools.NET.Extra.AssetsManager.LoadAssetsFileFromBundle(BundleFileInstance bunInst, Int32 index, Boolean loadDeps)

scenes_interiors_scenes_all.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions