AssetBundle Manager

AssetBundle Manager

  AssetBundleManager是一个款Unity公司制作的Unity库。

1、Simulation Mode

  The main advantage of using Simulation Mode is that Assets can be modified, updated, added, and deleted without the need to re-build and deploy the AssetBundles every time.

  It is worth noting that AssetBundle Variants do not work with Simulation Mode. If you need to use variants, Local AssetBundle Server is the option you need.

2、Local AssetBundle Server

  AssetBundleManager在Asset目录中提供了Build选项。

3、AssetBundleManager.Initialize()

  The AssetBundle Manager uses this manifest you load during the Initialize() to help with a number of features behind the scenes, including dependency management.

IEnumerator Start()

{
    yield return StartCoroutine(Initialize());
}
IEnumerator Initialize()
{
    var request = AssetBundleManager.Initialize();
if (request != null)
    yield return StartCoroutine(request);
}

4、Loading Assets

IEnumerator InstantiateGameObjectAsync (string assetBundleName, string assetName)

{
    // Load asset from assetBundle.
    AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject) );
    if (request == null)
        yield break;
    yield return StartCoroutine(request);
    // Get the asset.
    GameObject prefab = request.GetAsset<GameObject> ();
    if (prefab != null)
        GameObject.Instantiate(prefab);
}

5、Loading Scenes

IEnumerator InitializeLevelAsync (string levelName, bool isAdditive)

{
    // Load level from assetBundle.
    AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(sceneAssetBundle, levelName, isAdditive);
    if (request == null)
        yield break;
    yield return StartCoroutine(request);
}

6、ActiveVariants

IEnumerator InitializeLevelAsync (string levelName, bool isAdditive, string[] variants)

{
    //Set the activeVariants.
    AssetBundleManager.ActiveVariants = variants;
    // Load level from assetBundle.
    AssetBundleLoadOperation request = AssetBundleManager.LoadLevelAsync(variantSceneAssetBundle, levelName, isAdditive);
    if (request == null)
        yield break;
    yield return StartCoroutine(request);
}

时间: 2024-09-21 00:44:15

AssetBundle Manager的相关文章

[译]使用AssetBundle Manader

AssetBundle and the AssetBundle Manager 介绍 AssetBundle允许从本地或者远程服务器加载Assets资源,利用AssetBundles技术,Assets资源可以放在远程服务器上,这种技术增加了项目灵活性并且减少项目初始包的大小. 本文介绍AssetBundles并且讨论一步一步的介绍怎么样使用它,怎样将资源打包到AssetBundle中,如何使用以及如何处理资源的引用计数,所有这些我们都可以使用AssetBundle Manader来简化Asset

【Unity游戏开发】AssetBundle杂记--AssetBundle的二三事

一.简介 马三在公司大部分时间做的都是游戏业务逻辑和编辑器工具等相关工作,因此对Unity AssetBundle这块的知识点并不是很熟悉,自己也是有打算想了解并熟悉一下AssetBundle,掌握一下Unity资源管理方面的知识,因此有了这篇博客. 我会在博客中整理出一些自己学习时收集到的一些比较好的AssetBundle学习资料,并且结合现在正在参与开发的商业项目随时写下一些自己的拙见.本篇博客权当是马三自己的笔记和一些杂谈,会不断地随时随地的更新一些内容. 二.收集整理的一些AssetBu

Unity最新版打包AssetBundle和加载的方法

一.设置assetBundleName二.构建AssetBundle包三.上传AssetBundle到服务器四.把AssetBundle放到本地五.操作AssetBundle六.完整例子七.AssetBundle Manager管理工具八.备注知识 一.设置assetBundleName 如果没有设置AssetBundleName,会打包所有的Assets下的资源,如果设置,就只打包设置了名字的资源 1.在unity编辑器界面手动设置 输入所需的AssetBundle名称.请注意,AssetBu

Unity 官方教程 学习

Interface & Essentials Using the Unity Interface 1.Interface Overview https://unity3d.com/cn/learn/tutorials/topics/interface-essentials/interface-overview?playlist=17090 2.The Scene View https://unity3d.com/cn/learn/tutorials/topics/interface-essent

GJM: Unity3D AssetBundle 手记 [转载]

这篇文章从AssetBundle的打包,使用,管理以及内存占用各个方面进行了比较全面的分析,对AssetBundle使用过程中的一些坑进行填补指引以及喷! AssetBundle是Unity推荐的资源管理方式,官方列举了诸如热更新,压缩,灵活等等优点,但AssetBundle的坑是非常深的,很多隐藏细节让你使用起来需要十分谨慎,一不小心就会掉入深坑,打包没规划好,20MB的资源"压缩"到了30MB,或者大量的包导致打包以及加载时的各种低效,或者莫名其妙地丢失关联,或者内存爆掉,以及各种

Unity AssetBundle 爬坑!!!!!!!

AssetBundle是Unity推荐的资源管理方式,官方列举了诸如热更新,压缩,灵活等等优点,但AssetBundle的坑是非常深的,很多隐藏细节让你使用起来需要十分谨慎,一不小心就会掉入深坑,打包没规划好,20MB的资源"压缩"到了30MB,或者大量的包导致打包以及加载时的各种低效,或者莫名其妙地丢失关联,或者内存爆掉,以及各种加载失败,在网上研究了大量关于AssetBundle的文章,但每次看完之后,还是有不少疑问,所以只能通过实践来解答心中的疑问,为确保结果的准确性,下面的测试

Unity AssetBundle打包与资源更新

Unity的AssetBundle打包是一件让人头疼的事情,当我接手这项工作时,我以为最多只用两个周就可以把整个打包和资源热更新的流程搞定,结果还是花了一个月,期间踩坑无数,总结出来希望能够节约别人的时间. (一)你的游戏项目是什么类型的? 在开始写打包的Editor脚本之前,你最好先详细考察一下你们的游戏项目是什么类型?是端游,手游还是页游?因为这三者涉及到bundle包的资源管理策略截然不同,如果你们是跨平台发布,那我建议你最好用宏来切换管理策略. 我先分享一下我曾经接手过打包工作的两个项目

(转)Unity AssetBundle爬坑手记

转自:http://www.cnblogs.com/ybgame/p/3973177.html 这篇文章从AssetBundle的打包,使用,管理以及内存占用各个方面进行了比较全面的分析,对AssetBundle使用过程中的一些坑进行填补指引以及喷! AssetBundle是Unity推荐的资源管理方式,官方列举了诸如热更新,压缩,灵活等等优点,但AssetBundle的坑是非常深的,很多隐藏细节让你使用起来需要十分谨慎,一不小心就会掉入深坑,打包没规划好,20MB的资源“压缩”到了30MB,或

Unity AssetBundle爬坑手记

这篇文章从AssetBundle的打包,使用,管理以及内存占用各个方面进行了比较全面的分析,对AssetBundle使用过程中的一些坑进行填补指引以及喷! AssetBundle是Unity推荐的资源管理方式,官方列举了诸如热更新,压缩,灵活等等优点,但AssetBundle的坑是非常深的,很多隐藏细节让你使用起来需要十分谨慎,一不小心就会掉入深坑,打包没规划好,20MB的资源“压缩”到了30MB,或者大量的包导致打包以及加载时的各种低效,或者莫名其妙地丢失关联,或者内存爆掉,以及各种加载失败,