zoukankan      html  css  js  c++  java
  • AssetBundle Manager

    AssetBundle Manager

      AssetBundleManager是一个款Unity公司制作的Unity库。

    1、Simulation Mode

      The main advantage of using Simulation Mode is that Assets can be modified, updated, added, and deleted without the need to re-build and deploy the AssetBundles every time.

      It is worth noting that AssetBundle Variants do not work with Simulation Mode. If you need to use variants, Local AssetBundle Server is the option you need.

    2、Local AssetBundle Server

      AssetBundleManager在Asset目录中提供了Build选项。

    3、AssetBundleManager.Initialize()

      The AssetBundle Manager uses this manifest you load during the Initialize() to help with a number of features behind the scenes, including dependency management.

    IEnumerator Start()
    
    {
        yield return StartCoroutine(Initialize());
    }
    IEnumerator Initialize()
    {
        var request = AssetBundleManager.Initialize();
    if (request != null)
        yield return StartCoroutine(request);
    }
    View Code

    4、Loading Assets

    IEnumerator InstantiateGameObjectAsync (string assetBundleName, string assetName)
    
    {
        // Load asset from assetBundle.
        AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject) );
        if (request == null)
            yield break;
        yield return StartCoroutine(request);
        // Get the asset.
        GameObject prefab = request.GetAsset<GameObject> ();
        if (prefab != null)
            GameObject.Instantiate(prefab);
    }
    View Code

    5、Loading Scenes

    IEnumerator InitializeLevelAsync (string levelName, bool isAdditive)
    
    {
        // Load level from assetBundle.
        AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(sceneAssetBundle, levelName, isAdditive);
        if (request == null)
            yield break;
        yield return StartCoroutine(request);
    }
    View Code

    6、ActiveVariants

    IEnumerator InitializeLevelAsync (string levelName, bool isAdditive, string[] variants)
    
    {
        //Set the activeVariants.
        AssetBundleManager.ActiveVariants = variants;
        // Load level from assetBundle.
        AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(variantSceneAssetBundle, levelName, isAdditive);
        if (request == null)
            yield break;
        yield return StartCoroutine(request);
    }
    View Code
  • 相关阅读:
    8.7题解
    2019.9.16 csp-s模拟测试44 反思总结
    洛谷P3168 [CQOI2015]任务查询系统
    洛谷P2468 [SDOI2010]粟粟的书架
    2019.8.14 NOIP模拟测试21 反思总结
    2019.8.13 NOIP模拟测试19 反思总结
    2019.8.12 NOIP模拟测试18 反思总结
    大约是个告别【草率极了】
    2019.8.10 NOIP模拟测试16 反思总结【基本更新完毕忽视咕咕咕】
    2019.8.9 NOIP模拟测试15 反思总结
  • 原文地址:https://www.cnblogs.com/tekkaman/p/7616665.html
Copyright © 2011-2022 走看看