首页 > 其他 > 详细

Loading AssetBundle Manifests

时间:2017-10-01 09:30:33      阅读:377      评论:0      收藏:0      [点我收藏+]

Loading AssetBundle Manifests

  AssetBundle Manifest 可以用于获取dependency。

AssetBundle assetBundle = AssetBundle.LoadFromFile(manifestFilePath);
AssetBundleManifest manifest = assetBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");

  使用 GetAllDependencies 方法加载所有依赖

AssetBundle assetBundle = AssetBundle.LoadFromFile(manifestFilePath);
AssetBundleManifest manifest = assetBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
string[] dependencies = manifest.GetAllDependencies("assetBundle"); //Pass the name of the bundle you want the dependencies for.
foreach(string dependency in dependencies)
{
    AssetBundle.LoadFromFile(Path.Combine(assetBundlePath, dependency));
}

unload

  AssetBundle.Unload(bool); and if you should pass true or false into the function call. Unload is a non-static function that will unload your AssetBundle. This API unloads the header information of the AssetBundle being called. The argument indicates whether to also unload all Objects instantiated from this AssetBundle.

  If you were to use AssetBundle.Unload(true) the objects that you loaded from the AssetBundle, even if they’re being currently used in the active scene. This is what can cause textures to go missing, as we mentioned earlier.

  Let’s assume Material M is loaded from AssetBundle AB as shown below.

  If AB.Unload(true) is called. Any instance of M in the active scene will also be unload and destroyed.

  If you were instead to call AB.Unload(false) it would break the chain of the current instances of M and AB.

 

Loading AssetBundle Manifests

原文:http://www.cnblogs.com/tekkaman/p/7616661.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!