zoukankan      html  css  js  c++  java
  • AssetBundle依赖

    Managing asset dependencies

      一个Asset会依赖其它Asset。可以把一个Asset所依赖的Asset也打包进自己的AssetBundle。可是多个Asset可能依赖同一个/多个Asset。If a separate copy of a shared dependency is included in each bundle that has objects using it, then redundant instances of the assets will be created when the bundles are loaded. This will result in wasted memory.

      To avoid such wastage, it is possible to separate shared dependencies out into a separate bundle and simply reference them from any bundles with assets that need them.

      First, the referencing feature needs to be enabled with a call to BuildPipeline.PushAssetDependencies. Then, the bundle containing the referenced dependencies needs to be built. 

      Next, another call to PushAssetDependencies should be made before building the bundles that reference the assets from the first bundle. Additional levels of dependency can be introduced using further calls to PushAssetDependencies. 

      The levels of reference are stored on a stack, so it is possible to go back a level using the correspondingBuildPipeline.PopAssetDependencies function. 

      At runtime, you need to load a bundle containing dependencies before any other bundle that references them. For example, you would need to load a bundle of shared textures before loading a separate bundle of materials that reference those textures.

    注:以上是Unity老版本特性。在老版本中,Unity需要手动添加dependency。而在新版本中,无而手管理依赖关系,PushAssetDependencies API已经被移除。

    Asset IDs

      If you anticipate needing to rebuild asset bundles that are part of a dependency chain then you should build them with theBuildAssetBundleOptions.DeterministicAssetBundle option enabled. This guarantees that the internal ID values used to identify assets will be the same each time the bundle is rebuilt.

      When building the asset bundle with this method, the objects in it are assigned a 32 bit hash code that is calculated using the name of the asset bundle file, the GUID of the asset and the local id of the object in the asset. For that reason make sure to use the same file name when rebuilding. Also note that having a lot of objects might cause hash collisions preventing Unity from building the asset bundle.

      

  • 相关阅读:
    IE8的parseInt
    powershell小工具
    判断请求是不是ajax
    常用命令行/批处理
    服务器导出服务器时间转换浏览器端时区
    用批处理批量编译多个解决方案(.sln)
    shell脚本批量调用git命令
    批处理(.bat)For命令使用
    360doc的文章不能复制的解决办法
    XSD笔记
  • 原文地址:https://www.cnblogs.com/tekkaman/p/4031390.html
Copyright © 2011-2022 走看看