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

This is an issue about modifing all the texture2d assets' name in an AB contains texture2D and Sprite assets #119

Open
544051996 opened this issue Sep 7, 2023 · 1 comment

Comments

@544051996
Copy link

`AssetsManager manager = new AssetsManager();
var bunInst = manager.LoadBundleFile(bundlePath);
var bun = bunInst.file;
int fileTotal = bun.GetAllFileNames().Count;

for(int i = 0; i<fileTotal; i++)
{
var afileInst = manager.LoadAssetsFileFromBundle(bunInst, i, true);
var afile = afileInst.file;
foreach(var texInfo in afile.GetAssetsOfType(AssetClassID.Texture2D))
{
var texBase = manager.GetBaseField(afileInst, texInfo);
.......
}
}`

For AB contains both texture2D and Sprite assets, there is a NullReferenceException:Object reference not set to an instance of an object. AssetsTools.NET.Extra.AssetsManager.GetTemplateBaseField.
AssetsTools.NET.Extra.AssetsReadFlags.readFlags.
AssetsTools.NET.Extra.AssetsManager.GetTemplateBaseField.

For AB only contains texture2D asset it goes well and modified all the texture2D name successfully

@nesrak1
Copy link
Owner

nesrak1 commented Sep 8, 2023

GetTemplateBaseField is a big method so it could be anywhere. I doubt it has to do with sprites being in the bundle. Maybe check if your bundle has a type tree with afile.Metadata.TypeTreeEnabled? If it's not enabled, you need to load a tpk.

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