• 总结一下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);
  • 相关阅读:
    农村养殖业什么最赚钱?什么养殖项目行情好?
    加盟店可靠吗?如何识破加盟骗局?
    开小店做什么生意好?开小店需要营业执照吗?
    投资小的项目有哪些?投资小项目推荐
    贪心
    关于:Express会被Koa2取代吗?
    关于:Express会被Koa2取代吗?
    关于:Express会被Koa2取代吗?
    关于:Express会被Koa2取代吗?
    剑指offer
  • 原文地址:https://www.cnblogs.com/yuanjing/p/3362069.html
Copyright © 2020-2023  润新知