Code Monkey home page Code Monkey logo

bundlemaster's Introduction

BundleMaster


Unity资源加载大师(纯代码ET框架集成用)


网站地址: https://www.unitybundlemaster.com

视频教程

YouTube : https://www.youtube.com/watch?v=3P7yJu01j0I

B站 : https://www.bilibili.com/video/BV19341177Ek

QQ讨论群: 787652036

非ET框架集成版本: https://github.com/mister91jiao/BundleMaster_IntegrateETTask


注意事项:

WebGL 平台需要加上 BMWebGL 宏,部署使用 Local 模式运行(网页直接刷新就行所以不需要更新),注意避免正在异步加载一个资源的时候有同步加载同一个资源。

Switch 平台需要加上 Nintendo_Switch 宏,理论上可以进行热更但因为政策原因所以没有对更新功能进行适配,因此部署依然需要在 Local 模式 下运行,除此之外还要加上 NintendoSDKPlugin,不然会报错,政策原因不上传这部分内容,有需要switch开发需要可以找我联系


代码示例:

  //初始化流程
  public async ETTask Init()
  {
     //定义要检查的资源包名
     Dictionary<string, bool> updatePackageBundle = new Dictionary<string, bool>()
     {
        {"MainAssets", false},
     };
     //检查是否需要更新
     UpdateBundleDataInfo _updateBundleDataInfo = await AssetComponent.CheckAllBundlePackageUpdate(updatePackageBundle);
     if (_updateBundleDataInfo.NeedUpdate)
     {
        //增量更新更新
        await AssetComponent.DownLoadUpdate(_updateBundleDataInfo);
     }
     //初始化资源包
     await AssetComponent.Initialize("MainAssets");
  }

  //加载资源代码示例
  public async ETTask Example()
  {
     //同步加载资源
     GameObject playerAsset1 = AssetComponent.Load<GameObject>(out LoadHandler handler, "Assets/Bundles/Role/Player1.prefab");
     GameObject player1 = UnityEngine.Object.Instantiate(playerAsset1);

     //异步加载资源
     GameObject playerAsset2 = await AssetComponent.LoadAsync<GameObject>("Assets/Bundles/Role/Player2.prefab");
     GameObject player2 = UnityEngine.Object.Instantiate(playerAsset2);
        
     //卸载资源
     handler.UnLoad();
     AssetComponent.UnLoadByPath("Assets/Bundles/Role/Player2.prefab");
  }

  //别忘了配置生命周期
  void Update()
  {
     AssetComponent.Update();
  }
  void OnLowMemory()
  {
     //移动平台低内存时候调用,可选
     //AssetComponent.ForceUnLoadAll();
  }
  void OnDestroy()
  {
     //如果当前正在更新资源,取消更新
     _updateBundleDataInfo?.CancelUpdate();
     //游戏销毁调用
     AssetComponent.Destroy();
  }


友情链接:

JEngine 一款不错的客户端框架: https://github.com/JasonXuDeveloper/JEngine

HybridCLR 革命性的热更新解决方案: https://github.com/focus-creative-games/hybridclr

bundlemaster's People

Contributors

mister91jiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bundlemaster's Issues

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.