How use asset bundle for a image folder ?

Hi everyone,

I want create an assetbundle from a image folder (only images inside: for change textures in my scenes).
I’m using this code for export the asset (in JavaScript):

@MenuItem ("Assets/Build AssetBundle From Selection - Track dependencies")
static function ExportBundle(){

        var str : String = EditorUtility.SaveFilePanel("Save Bundle...", Application.dataPath, Selection.activeObject.name, "assetbundle");
        if (str.Length != 0){
             BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, str, BuildAssetBundleOptions.CompleteAssets, BuildTarget.iPhone);
        }
}

and then use this on my image folder to got “myBundle.assetbundle” file at “Assets/Assetbundles/” path.

I use this C# script for import the asset bundle:

 using UnityEngine;
 using System.Collections;
 using System;
    
    public class ImportAssetBundle : MonoBehaviour {
    	private WWW www;
    	public string AssetName = "myBundle";
    	
    	void Start () {
    	StartCoroutine( DownloadAndCache());
    	}
    	IEnumerator DownloadAndCache() 
    	{
    		string BundleURL = "file://" + Application.dataPath +  "/Assets" + "/Assetbundles" + "/" + AssetName + ".assetbundle";
    	   // Download the file from the URL. It will not be saved in the Cache
    	   using (WWW www = new WWW(BundleURL)) {
    		   yield return www;
    		   if (www.error != null)
    			   throw new Exception("WWW download had an error:" + www.error);
    		   AssetBundle bundle = www.assetBundle;	
    		   if (AssetName == "")
    			Instantiate(bundle.mainAsset);
    		   else
    			   bundle.LoadAll();
                       // Unload the AssetBundles compressed contents to conserve memory
    			bundle.Unload(false);
    
    	   } // memory is freed from the web stream (www.Dispose() gets called implicitly)
    	}
    }

And now, i would like use these images for change all textures in another C# script, but i don’t know how call these images.
I want do something like:

www = new WWW ("file://" + Application.dataPath +  "/Assets" + "/Assetbundles" + "myImage.jpg");
myMaterial.mainTexture = www.texture;

for update new textures, but this path is wrong, “myImage.jpg” is inside my assetbundle.
Note: I’m building on iOS device.

Any though?
Thanks.

try this :
myMaterial.maintexture= (Texture)bundle.Load(AssetName,typeof(Texture));