- Home /
Question by
Crayz · Jun 27, 2015 at 08:45 PM ·
c#assetbundlememory
Best way to load assets from AssetBundle?
I'm curious if there's a more or less efficient way to load assets from an AssetBundle. At first I stored loaded AssetBundles in a dictionary and called bundle.LoadAsset() to retrieve and instantiate an object from the bundle.
I now iterate through all objects of a bundle immediately after loading the bundle and store them in a dictionary, key being the asset's name and value being the asset's GameObject. Doing it this way I can simply call dictionary.TryGetValue(name, out obj) then instantiate obj, rather then calling LoadAsset() every time I need an object.
Is there a recommended method of loading/instantiating objects from a bundle?
Comment
Answer by sauravmohanv · Nov 21, 2018 at 06:01 AM
@Crayz this is the easiest and simplest way to do that.
Your answer
![](https://koobas.hobune.stream/wayback/20220613201454im_/https://answers.unity.com/themes/thub/images/avi.jpg)