I’ve tried all permutations and they all fail. Here are the results:
These all crash the editor:
var prefab = myLoadedAssetBundle.LoadAsset(“Assets/AssetBundleSource/ItemTemplates/3DO.prefab”);
var prefab = myLoadedAssetBundle.LoadAsset(“3DO.prefab”);
var prefab = myLoadedAssetBundle.LoadAsset(“3DO”);
These all return null:
ItemTemplate ret = myLoadedAssetBundle.LoadAsset(“Assets/AssetBundleSource/ItemTemplates/3DO.prefab”, typeof(ItemTemplate)) as ItemTemplate;
ItemTemplate ret = myLoadedAssetBundle.LoadAsset(“3DO.prefab”, typeof(ItemTemplate)) as ItemTemplate;
ItemTemplate ret = myLoadedAssetBundle.LoadAsset(“3DO”, typeof(ItemTemplate)) as ItemTemplate;
Here’s the contents of the assetbundle manifest if that helps:
Dunno if this is the same issue, but I had this issue when having two assets with the same name but different extension. So for my case had i had “test.json” and “test.prefab” and it would still get confused even if you specified the type correctly. i just added a suffix to resolve it.
Hi,
I have the same problem right now. Anyone have found a solution ?
Unload and Load the bundle again solve the problem. Same behavior : Contains return true, load return null.
Hi all!
Have you tried calling GetAllAssetNames() to get the list of names packed in the AssetBundle? For example, the following loads the first item of the AssetBundle named “modal”:
var bundle = AssetBundle.LoadFromFile($"{Application.streamingAssetsPath}/modal");
var names = bundle.GetAllAssetNames();
var modalBundle = bundle.LoadAsset(names[0]);
Additionally, you can inspect the content of the Asset Bundle in the AssetBundle Browser: