Include an AssetBundle inside other AssetBundle

Is it possible to include an AssetBundle inside other AssetBundle.

Example: I have an assetbundle with some prefabs and so. I have another Scene AssetBundle. Is it possible to create one assetbundle including the other ?

If yes, how to load them both?

Thanks in advance.

I think the question was not asked in understandable manner and that’s y there is no reply till this time.

Let me answer my own question, In case somebody looking for this type of info.

Assetbundle can be put into another assetbundle. This was explained in Unity Manual in “Protecting Content” in it’s third approach.

Simply put, Create first assetbundle and rename it’s file extension to .bytes or .txt and add it to Unity Project as TextAsset. Now you can build second assetbundle and include this renamed assetbundle as TextAsset.

How to load it: Simple. You can load assetbundle and load TextAsset which is actually inner assetbundle which was stored as TextAsset. Now, read bytes from textasset and create assetbundle from memory.

Ex:

WWW www = new WWW(url);
//or 
//WWW www = WWW www = new WWW.LoadFromCacheOrDownload(url,1);

TextAsset textAsset = www.assetBundle.Load("inner_asset_bundle", typeof(TextAsset));
 
    // Get the byte data
    byte[] ab_bytes = textAsset.bytes;

    // Create an AssetBundle from the bytes array
    AssetBundleCreateRequest acr = AssetBundle.CreateFromMemory(ab_bytes);
    yield return acr;

    AssetBundle bundle = acr.assetBundle;

Hope it’s clear and understandable.