Example #1
0
    public void AsyncLoad(string bundlePath, string assetName, LoadDelegate lad)
    {
        StartCoroutine(AsyncLoadBundle(bundlePath, delegate(BundleHolder bh)
        {
            if (bh == null)
            {
                lad?.Invoke(null);
                return;
            }

            StartCoroutine(AsyncLoadAsset(bh.bundle, assetName, delegate(Object obj)
            {
                if (obj == null)
                {
                    lad?.Invoke(null);
                    bh.TryRelease();
                    return;
                }

                AssetRef ar = new AssetRef();
                ar.asset    = obj;
                ar.bh       = bh;
                ar.Retain();
                lad?.Invoke(ar);

                bh.TryRelease();
            }));
        }));
    }
Example #2
0
 /// <summary>
 /// Invoke all registered Load methods.
 /// </summary>
 public void LoadAll(bool suppressException = true)
 {
     LoadDelegate?.Invoke(suppressException);
 }