- Home /
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?
Answer by DaveA · Mar 20, 2012 at 01:34 AM
LoadAsync (name : String, type : Type)
So wouldn't it be
asset = AssetBundle.LoadAsync ("theName", Texture); // ?
Answer by MOrlando · Mar 20, 2012 at 03:02 AM
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. :) )1
Your answer
![](https://koobas.hobune.stream/wayback/20220613065322im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Loading multiple Assetbundles causes a Crash 1 Answer
How to import the object from server to unity 2 Answers
Assetbundle memory leaks 0 Answers
On-Demand Resource iOS/Android - AssetBundles 1 Answer
AssetBundle.Unload(false) 2 Answers