Locus-Bundle-System:支持同步API的简单Unity可寻址对象替代方案

  • y9_592822
    了解作者
  • 67.5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-21 10:43
    上传日期
统一的轨迹捆绑系统 unity5的Assetbundle系统在将来将是绝对的。 Unity Addressables系统提供了非常灵活的实施方案,适合任何项目。 但是以我的经验来看,有一个巨大的学习曲线可以进入。 而且,没有Resource.Load Users熟悉的同步api。 因此,这是我自己的捆绑软件系统,它也利用可脚本化的Build Pipline,并提供了同步的API。 这是为了支持我所遇到的非常常见的感觉。 但是您可以故意扩展它。(只需进行分叉并进行修改) 同步的API支持! Unity Addressables系统的主要优点是内存管理。 它根据捆绑软件的引用计数卸载捆绑软件。 因此,您无需调用挂起游戏玩法的Resources.UnloadUnusedAssets()函数。 我的支持相同的功能以及同步的api。 这是通过缓存WWWRequest来完成的。 注意,缓存
Locus-Bundle-System-master.zip
内容介绍
# Locus Bundle System For Unity [Unity Forum Thread](https://forum.unity.com/threads/simpler-alternative-to-addressables.820998) [![openupm](https://img.shields.io/npm/v/com.locus.bundlesystem?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.locus.bundlesystem/) Assetbundle system from unity5 will be obsolute in future.\ Unity Addressables system provides very flexible implementation that fits on any project.\ But for my experience, there's huge learning curve to get into it.\ And also, there's no synchronized api which is familier to **Resource.Load** Users. So here is my own bundle system that also utilizes Scriptable Build Pipline and it provides synchronized API. This is build up to support very common senarios I've experienced.\ But you can extend this on purpose.(just fork and make modifications) \ **Synchronized API Support!** Main pros of Unity Addressables system is memory management.\ It unloads bundle according to bundle's reference count.\ So you don't need to call Resources.UnloadUnusedAssets() function which hangs your gameplay. Mine support same functionality as well as synchronized api.\ This is done by caching WWWRequest.\ Note that caching assetbundles eats some memory(but quite low) When a assetbundle's reference count is zero.\ It fires another assetbundle request and cache up until assetbundle can be unloaded and swapped. \ **Folder based Bundle & Local Bundles** Like using Resources folder, you can specify folder that you want to make bundle(there's no bundle name in each asset).\ It's very comfortable for users that loves organizing contents using Folders like me. And using local bundles, you can ship part of your bundles in player build.\ It also can be changed later on by patching. ## Introduction Video [![Check this out](http://img.youtube.com/vi/49WKJRscDrA/0.jpg)](http://www.youtube.com/watch?v=49WKJRscDrA "Locus Bundle System Intro") ## How to Setup **Assets -> Create -> Create Bundle Build Settings** Create AssetBundleSettings ScriptableObject using Context Menu.\ This object can be anywhere under Assets folder **Setup Bundle Informations** ![BundleSettingInspector](https://user-images.githubusercontent.com/6591432/73616925-a527b580-465c-11ea-8c82-b004e3822d98.png) 1. *Bundle List* - BundleName : Assetbundle's name which you should provide when loading object from AssetBundles. - Included In Player : if true, this bundle will be shipped with player(also can be updated). - Folder : Drag or select folder, assets under that folder will be packed into this bundle. - Include Subfolder : if true, will search assets from subfolders recurviely, your asset name when loading will be [SubFolderPath]/[AssetName] - Compress Bundle : if true, it will use LMZA compression. otherwise LZ4 is used. Shipped local bundles will be always LZ4 2. *Output Folder and URL* - Specify your Local/Remote bundle build output path here, also provide Remote URL for remote patch. 3. *Editor Functionalities* - Emulate In Editor : Use and Update actual assetbundles like you do in built player. - Emulate Without Remote URL : if true, remote bundle will be loaded from remote output path, useful when your CDN is not ready yet. - Clean Cache In Editor : if true, clean up cache when initializing. - Force Rebuild : Disables BuildCache (When Scriptable Build Pipline ignores your modification, turn it on. It barely happens though) 4. *Useful Utilities.* - Cache Server : Cache server setting for faster bundle build(you need seperate Cache server along with asset cache server) - Ftp : if you have ftp information, upload your remote bundle with single click. **Multiple Settings** ![FindActiveSetting](https://user-images.githubusercontent.com/6591432/73616927-a5c04c00-465c-11ea-9689-3b8e5cdd4970.png)\ ![ActiveSetting](https://user-images.githubusercontent.com/6591432/73616924-a527b580-465c-11ea-8cff-a4bfa60faf0a.png)\ Multiple AssetbundleSettings are supported.\ You can set one of them as your active AssetbundleBuildSetting(Saved in EditorPref).\ You can find active AssetbundleBuildSetting in menu. **Auto Optimize Your Bundles** This system support automated assetbundle optimization.\ Which means, it automatically findout duplicated top-most assets in your bundle dependency tree,\ and make them into seperated shared bundles. By using this, you can easily manage your dependencies, and there will be **no** duplicated assets included in your assetbundles.\ ![image](https://user-images.githubusercontent.com/6591432/86381697-7cb5ed00-bcc8-11ea-8f84-75e248828e42.png)\ If you find out execpted shared bundles are created, define a bundle warp them up, it'll automatically disappeared in next build.\ ![image](https://user-images.githubusercontent.com/6591432/86384732-1c27af80-bcca-11ea-84f9-7791a7598969.png) **Folders in Packages** This system can handle assets in Packages Folder.\ If you can drag folder from there, It'll be fine.(development/local packages)\ But if you dragging is freezed, just copy and paste it's path.\ ![CapturePath](https://user-images.githubusercontent.com/6591432/99907679-85639a00-2d21-11eb-9414-f3ccf8682871.png)\ ![PasteButton](https://user-images.githubusercontent.com/6591432/99907681-8694c700-2d21-11eb-817a-c30392b2a180.png) **Bundled Asset Path** This is a utility struct that helps you save some time to write actual path yourself. ```cs BundleSystem.BundledAssetPath MyAsset; ``` ![Honeycam 2020-12-19 23-25-54](https://user-images.githubusercontent.com/6591432/102692341-072de100-4256-11eb-9634-9203cd2761ab.gif) ## API Examples \ **Initialization Example** ```cs IEnumerator Start() { //show log message BundleManager.LogMessages = true; //show some ongui elements for debugging BundleManager.ShowDebugGUI = true; //initialize bundle system & load local bundles yield return BundleManager.Initialize(); //get download size from latest bundle manifest var manifestReq = BundleManager.GetManifest(); yield return manifestReq; if (!manifestReq.Succeeded) { //handle error Debug.LogError(manifestReq.ErrorCode); } Debug.Log($"Need to download { BundleManager.GetDownloadSize(manifestReq.Result) * 0.000001f } mb"); //start downloading var downloadReq = BundleManager.DownloadAssetBundles(manifestReq.Result); while(!downloadReq.IsDone) { if(downloadReq.CurrentCount >= 0) { Debug.Log($"Current File {downloadReq.CurrentCount}/{downloadReq.TotalCount}, " + $"Progress : {downloadReq.Progress * 100}%, " + $"FromCache {downloadReq.CurrentlyLoadingFromCache}"); } yield return null; } if(!downloadReq.Succeeded) { //handle error Debug.LogError(downloadReq.ErrorCode); } //start to game } ``` \ **API Examples** ```cs IEnumerator ApiSamples() { //Sync loading { var loaded = BundleManager.Load<Texture2D>("Texture", "TextureName"); //do something BundleManager.ReleaseObject(loaded); } //Async loading { var loadReq = BundleManager.LoadAsync<Texture2D>("Texture", "TextureName"); yield return loadReq; //do something loadReq.Dispose(); } //Asnyc loading with { //use using clause for easier release using (var loadReq = BundleManager.LoadAsync<Texture2D>("Texture", "TextureName")) { yield return loadReq;
评论
    相关推荐
    • Unity缓存识别插件.rar
      Unity3D识别3DMAX点缓存动画插件 网格变形 顶点动画 并支持所有的开发平台,从 PC、Mac、网页浏览或是 iPhone
    • SerializableCallback:UnityEvent和System.Func有一个孩子
      它使用表达式树和反射在第一次执行时缓存委托。 用法与UnityEvent相同 public class MyClass : MonoBehaviour { // These fields are shown in the inspector public SerializableCallback callback ; // ...
    • Verint Community Developer Shortcuts-crx插件
      Telligent社区9.x,10.x和Verint社区11.x-清除所有缓存-清除UI缓存-清除数据缓存-重新加载插件-Widget Studio-关闭Widget Studio中打开的Widget-Widget API文档(使用9.1时不可用+)-例外-Guid Generator-编辑当前...
    • Unity Navigation2D
      unity 2D网格寻路,Navigation2D,插件,烘焙,2D网格寻路
    • unity AssetBundle系统
      包含了一套AssetBundle系统,可以快速开发AssetBundle
    • [Unity]对象缓存池PoolManager.rar
      [Unity]对象缓存池PoolManager,2019版本以上
    • Unity3d插件 TargetPRO
      Target-Pro的是一个非常强大和性能友好的框架,检测目标的范围内提供的事件,传递消息和API缓存引用。这是不是另一个炮塔AI系统。 Target-Pro的任何游戏,需要游戏物体进入其他游戏对象的范围,快速,高效的检测和...
    • C# UnityLog
      简单的可扩展Unity日志Frame,可以放心打日志,各种level来控制日志输出,也可以扩展成为string缓存日志,文件日志等
    • unity 手机录屏插件
      unity 手机录屏插件
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等