Locus-Bundle-System icon indicating copy to clipboard operation
Locus-Bundle-System copied to clipboard

LoadWithSubAssets issue

Open chebedzic opened this issue 2 years ago • 2 comments

Hi there,

We were hoping to find a replacement for resources.loadall method, and bumped into a LoadWithSubAssets method, but there is an issue with it in the code snippet bellow,So it searches for Sprites, but finds Texture2D, So no results are type compatible, and the only reason it works is that the default value(which is not changed) of found index is 0, or the first element is returned.

https://github.com/locus84/Locus-Bundle-System/blob/bc8d911dfd4318631d71e5dd160eacd1dd53c389/Runtime/EditorAssetMap.cs#L63-L82

Also while we are discussing this method is there a way to do LoadWithSubAssets, that loads multiple prefabs/scriptable objects from a subdirectory, we are currently working with GetAllAssetNames(), method and parsing the string to check for subdirectories.

chebedzic avatar Mar 21 '22 11:03 chebedzic

Can you explain what exactly you want to achieve? So I can test with the case. Or you can share sample project I can reproduce the issue.

locus84 avatar Mar 22 '22 11:03 locus84

we are trying to load multiple assets inside of a subdirectory of a bundle. Like we would use Resources.LoadAll<CustomClass>("Images/Specia/3l"). So we are trying to load all of the assets in that folder.

but while doing it we tried to write our own method. using Bundle.GetAllAssetNames(), and parse the names to fit our directory needs.

So while doing all of this we bumped into an issue with quoted method up there.

foundIndex is zero.

If no object with appropriate type is found it remains zero.

returned object from method is the first element of the assets array.

chebedzic avatar Mar 22 '22 13:03 chebedzic