AssetBundle.mainAsset

Hello,

I’m wondering if assetBundle.mainAsset performs the same operation that assetBundle.Load() does, just without the need to specify a name of the asset.

I’m downloading several asset bundles and I’d like to asynchronously load them to avoid any unnecessary hitching during gameplay. My problem is that I either need to impose a restriction on the naming of the asset (it’ll need to always be the same thing so when I load all of them I can pass in the string for the name easily enough) or load the actual texture via assetBundle.mainAsset.

Is there another way for me to load the texture within the asset bundle, ideally asynchronously?

LoadAsync (name : String, type : Type)

So wouldn’t it be

asset = AssetBundle.LoadAsync (“theName”, Texture); // ?

My issue is more related to the fact that I have to supply a string for the asset’s name. I’m trying to write a flexible system that doesn’t require the name of the asset to always be exactly the same thing (otherwise causing the entire system to come to a crash).

I have no quarrels with using the assetBundle.mainAsset, however I feel like the ability to load asynchronously outweighs the naming restriction. It doesn’t look like I can get the best of both worlds, so I suppose I may need to take the lesser of the 2 evils (sounds more dramatic than it is. :slight_smile: )1