我已经创建了将资产包下载并存储到我的设备的功能 . 现在我正在尝试从已下载的捆绑包中加载一个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));
    }
}

但是,当我运行它时,没有任何东西加载 .

我究竟做错了什么?