zoukankan      html  css  js  c++  java
  • 总结一下asset bundle的相关知识:

    1.通过脚本创建:BuildPipeLine.BuildAssetBundle、BuildPipeline.BuildScreamedSceneAssetBundle、BuildAssetBundleExplictAssetNames
    2.www类下载assetbundle
    var www:WWW = new WWW(url);
    yield www;
    render.material.mainTexture=www.mainAsset;
    或者
    var www=WWW.loadFromCacheOrDownload("http://")
    yield www;
    www.assetbundle.mainasset
    3.从流中创建assetbundle
    www=WWW(url)
    yield return www;
    byte[] data=www.bytes;
    assetbundle = AssetBundle.createfromMemory(data)
    4.从assetbundle中加载具体的asset
    assetbundle.load  / loadasync /loadall
    或者
    application.loadLevel /loadLevelAsync / loadLevelAddtive
    5.实例化assetbundle
    www = new WWW(URL)
    yield www;
    Instantiate(www.assetbundle.mainAsset)
    6.释放
    assetbundle.destory / unload(true/false) / unloadUnusedAssets
    //////////////高级/////////////////////////////////////////////////////////////////////////
    7.assets之间的依赖
    BulidPipeline.PushAssetDependencies  / PopAssetDependencies
    8.Editor与runtime之间共享数据
    切分场景为不同的assetBundles,划分场景的信息单独放在一个assetbundles钟,先加载划分信息
    list<Object> toinclude = new 
    string stringHolderPath = "assets/scriptabel.asset"
    stringHolder content = ScriptableObject.CreateInstance<string>();
    UnityEditor.AssetDatabase.CreateAsset(content,stringholderpath);
    toinclude.add(UnityEditor.assetDatabase.loadAssetAtPath(stringholder,typeof(stringholder)));
    BuildPipeline.bulidAssetBundle(null,toinclude,toarray,testAssetBundlePath);
  • 相关阅读:
    Codeforces 700A As Fast As Possible(二分答案)
    BZOJ 1196 [HNOI2006]公路修建问题(二分答案+并查集)
    Codeforces 701C They Are Everywhere(Two pointers+STL)
    Codeforces 430B Balls Game(Two Pointers)
    CSU 1812 三角形和矩形
    CSU 1804 有向无环图
    CSU 1803 2016
    CSU 1808 地铁
    CodeForces 707B Bakery
    CodeForces 707A Brain's Photos
  • 原文地址:https://www.cnblogs.com/yuanjing/p/3362069.html
Copyright © 2011-2022 走看看