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);
  • 相关阅读:
    重要:VC DLL编程
    VC++程序员如何做好界面
    复习二叉搜索树作的几道题
    eclipse JAVA反编译
    秒,毫秒,微秒,纳秒,皮秒,飞秒
    redis实现tomcat集群session共享
    redis启用持久化
    Spring
    Spring scope
    FastJSON 使用
  • 原文地址:https://www.cnblogs.com/yuanjing/p/3362069.html
Copyright © 2011-2022 走看看