Esempio n. 1
0
    public IEnumerator loadAssetBundle(string path, loadFinishCb loadFinish)
    {
        AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path);

        yield return(request);

        AssetHander hander = new AssetHander();

        hander.assetBundle = request.assetBundle;
        hander.addRef();
        _mapAssetHander.Add(path, hander);
        loadFinish(_mapAssetHander[path]);
    }
Esempio n. 2
0
    public IEnumerable loadAssetBundleWeb(string path, loadFinishCb loadFinish)
    {
        UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(path);

        yield return(request.SendWebRequest());

        if (request.isHttpError || request.isNetworkError)
        {
            Debug.Log("path is Error" + path + " " + request.error);
        }
        else
        {
            AssetHander hander = new AssetHander();
            hander.assetBundle = DownloadHandlerAssetBundle.GetContent(request);
            hander.addRef();
            _mapAssetHander.Add(path, hander);
            loadFinish(_mapAssetHander[path]);
        }
    }