码迷,mamicode.com
首页 > 其他好文 > 详细

Loading AssetBundle Manifests

时间:2017-10-01 10:11:06      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:ada   name   pass   unity   iat   href   das   ext   called   

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

标签:ada   name   pass   unity   iat   href   das   ext   called   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!