GithubHelp home page GithubHelp logo

ly07 / unityresourcemgr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from billwillman/unityresourcemgr

1.0 1.0 0.0 60.7 MB

C# 82.82% Java 0.62% C++ 1.29% Makefile 0.03% Objective-C 0.35% C 0.36% ShaderLab 1.51% Python 1.26% Shell 0.65% Batchfile 0.40% Lua 10.51% HTML 0.04% CSS 0.02% JavaScript 0.14%

unityresourcemgr's Introduction

UnityResourceMgr

项目说明:主要实现基于UNITY资源管理以及更新打包的统一流程机制。有针对资源做Cache并带有一定的资源清理机制。

主要接口:ResourcMgr

切换场景:

  1. ResourceMgr.Instance.CloseScene当前场景
  2. ResourceMgr.Instance.LoadScenex新场景
  3. OnLevelWasLoaded中,调用 AssetCacheManager.Instance.ClearUnUsed(); ResourceMgr.Instance.UnloadUnUsed();

压缩AB, LZ4 AB,非压缩AB,Resources读取都支持。5.3版本支持同步和异步读取所有类型的AB。5.3之前版本,同步函数只支持Resources和非压缩AB, LZ4(5.x才有),异步加载均全支持。 外部使用接口,并不用关心具体文件是在Resources里还是在StreamAssets还是在下载目录,均使用一种方式读取(只有选择同步和非同步的区别)。

--》》重大更新:

1.已经支持LZ4了。另:已经支持同步和异步读取Sprite[]。异步读取LZO压缩,采用5.3版本的LoadFromAsync读取AB。

2.LZMA的读取,在5.3版本采用LoadFromFile和LoadFromFileAsync,在5.3之前版本使用WWW读取(所以5.3可以支持同步和异步,而5.3之前只支持异步)

3.增加了NGUIResLoader, 方便NGUI内部UI框架调用资源加载,简化繁琐的引用计数管理(针对NGUI)

4.增加BaseResLoader, 方便在MonoBehaviour中使用,简化繁琐的引用计数管理

5.依赖文件配置读取,最新采用二进制读取.

6.ResourceMgr的Destroy接口已经支持对原始资源进行Resources.UnloadAsset(第二个参数设置为true),但注意,使用要非常小心,只有非常确认外面没有使用的情况下(Sprite要保证它对应的纹理都没有被其他地方使用),否则其他地方会丢失资源。并且不能针对GameObject进行Resources.UnloadAsset,因为Resources.UnloadAsset只能删除非可见资源。

  7.已经支持DLL热更新,生成DLL热更新步骤:1)右键先编译 CSHARP工程。2)打包APK

  8.增量AssetBundle已经完全支持。

  9.支持脚本一键打包,脚本开发语言为Python, 命令行运行 python autobuild.py或者直接双击autobuild.bat(Windows平台),脚本运行需要安装psUtil库,Windows直接安装psUtil-setup(在AutoBuild/setup里),Mac下查看psutil.sh脚本内容,安装psutil库。

  10.AB的依赖配置文件支持三种方式加载:1.同步加载。2.多线程加载(基于改造后的LOOM库,不使用系统线程池,系统线程池在5.3.8版本会有几率卡死,申请不到额外线程)。3.协程异步加载。

具体说明请看WIKI: https://github.com/billwillman/UnityResourceMgr/wiki/%E7%9B%AE%E5%BD%95

已经支持5.3和5.6版本UNITY, UNITY 2018也做了兼容。

发现Unity 2018更改底层后导致的一个问题:就是AsyncOperation的isDone属性的赋值,貌似UNITY底层放到子线程赋值了,导致主线程同步执行两个函数,isDone的判断不一致,第一个为false, 另外一个为true, 导致有概率资源加载不出来,此问题已经修正。在5.3中,没有此问题。

脚本sign_obb目录里build.py是用来拆分 APK + obb, 用于上GOOGLE平台等海外需求使用。

todo: 将读取AssetBundles.xml放在C++层解析,进一步减少MONO堆内存使用量

unityresourcemgr's People

Contributors

billwillman avatar zhaohaiying1222 avatar

Stargazers

Nirvana.Chai avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.