C# 从编辑器加载assetbundle

C# 从编辑器加载assetbundle,c#,unity3d,assetbundle,C#,Unity3d,Assetbundle,我已经创建了下载资产包并将其存储到设备的功能。现在,我正在尝试从已下载的捆绑包加载assetbundle 我这样保存捆绑包: IEnumerator Start () { WWW urlToLoad = new WWW(url); yield return urlToLoad; //read in JSON data string jsonContents = urlToLoad.text; var n = JSON.Parse(jsonContents

我已经创建了下载资产包并将其存储到设备的功能。现在,我正在尝试从已下载的捆绑包加载assetbundle

我这样保存捆绑包:

IEnumerator Start ()
{
    WWW urlToLoad = new WWW(url);
    yield return urlToLoad;

    //read in JSON data
    string jsonContents = urlToLoad.text;
    var n = JSON.Parse(jsonContents);
    jsonURL = n["data"][0];
    Debug.Log(jsonURL.ToString());


    // split up the json and get last element in teh array
    string[] splitJSONURL = jsonURL.Split('/');
    string bundle = splitJSONURL[splitJSONURL.Length - 1];

    Debug.Log("array: " + bundle.ToString());

    //StartCoroutine(   DownloadAndCache());

    // save bundle to the application folder
    string path = Application.persistentDataPath + "/" + bundle;
    Debug.Log("Path: " + path);
    SaveBytesAsFile(path, urlToLoad.bytes);
    savedBundleString = Application.persistentDataPath + "/" + bundle;
}
接下来,我将尝试按如下方式加载捆绑包:

IEnumerator LoadLocalBundle(string filePath)
{
    print("Loading from local file..." + filePath);
    WWW www = new WWW(filePath);
    yield return www;

    if(www.error == null)
    {
        print ("loaded local bundle - instantiating :: " + www.assetBundle.mainAsset.name);
        GameObject bundleInstance = (GameObject)Instantiate(www.assetBundle.mainAsset);
        assetBundle = www.assetBundle;

    }

}


void OnGUI()
{
    if (GUI.Button(new Rect(10, 70, 50, 30), "Click"))
    {
        StartCoroutine( LoadLocalBundle(savedBundleString));
    }
}
但是,当我运行这个时,没有加载任何内容

我做错了什么