public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleAdapter.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (m_IsAdditive)
            {
                m_Request = Application.LoadLevelAdditiveAsync(m_LevelName);
            }
            else
            {
                m_Request = Application.LoadLevelAsync(m_LevelName);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
    // Initialize the downloading url and AssetBundleManifest object.
    protected IEnumerator Initialize()
    {
        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);

#if UNITY_EDITOR
        Debug.Log("We are " + (AssetBundleAdapter.SimulateAssetBundleInEditor ? "in Editor simulation mode" : "in normal mode"));
#endif

        string platformFolderForAssetBundles =
#if UNITY_EDITOR
            GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);
#else
            GetPlatformFolderForAssetBundles(Application.platform);
#endif

        // Set base downloading url.
        string relativePath = GetRelativePath();
        AssetBundleAdapter.BaseDownloadingURL = relativePath + kAssetBundlesPath + platformFolderForAssetBundles + "/";

        // Initialize AssetBundleManifest which loads the AssetBundleManifest object.
        var request = AssetBundleAdapter.Initialize(platformFolderForAssetBundles);
        if (request != null)
        {
            yield return(StartCoroutine(request));
        }
    }
    protected IEnumerator LoadLevel(string assetBundleName, string levelName, bool isAdditive)
    {
        Debug.Log("Start to load scene " + levelName + " at frame " + Time.frameCount);

        // Load level from assetBundle.
        AssetBundleLoadOperation request = AssetBundleAdapter.LoadLevelAsync(assetBundleName, levelName, isAdditive);

        if (request == null)
        {
            yield break;
        }
        yield return(StartCoroutine(request));

        // This log will only be output when loading level additively.
        Debug.Log("Finish loading scene " + levelName + " at frame " + Time.frameCount);
    }
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleAdapter.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
            return(false);
        }
        else
        {
            return(true);
        }
    }
    protected IEnumerator Load(string assetBundleName, string assetName)
    {
        Debug.Log("Start to load " + assetName + " at frame " + Time.frameCount);

        // Load asset from assetBundle.
        AssetBundleLoadAssetOperation request = AssetBundleAdapter.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject));

        if (request == null)
        {
            yield break;
        }
        yield return(StartCoroutine(request));

        // Get the asset.
        GameObject prefab = request.GetAsset <GameObject> ();

        Debug.Log(assetName + (prefab == null ? " isn't" : " is") + " loaded successfully at frame " + Time.frameCount);

        if (prefab != null)
        {
            GameObject.Instantiate(prefab);
        }
    }