Beispiel #1
0
    public IEnumerator AsyncInit()
    {
        CAssetBundleManager abm = CAssetBundleManager.Instance;

        bool        loadDone    = false;
        AssetBundle assetBundle = null;

        abm.LoadAssetBundleName(m_assetBundleToLoad, (a) => {
            loadDone    = true;
            assetBundle = a;
        });

        while (!loadDone)
        {
            yield return(false);
        }

        if (assetBundle != null)
        {
            //instantiate
            GameObject pfb = assetBundle.LoadAsset <GameObject>(m_prefabToLoad);

            if (pfb != null)
            {
                GameObject.Instantiate(pfb);
            }
            else
            {
                Debug.LogWarning("Asset not found : ");
            }
        }



        yield return(true);
    }