Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Loxodon Framework Bundle(AssetBundle)

Discussion in 'Assets and Asset Store' started by LoxodonStudio, Aug 9, 2018.

  1. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27

    AssetBundle Manager for Unity3D

    Loxodon Framework Bundle is an AssetBundle manager.It provides a functionality that can automatically manage/load an AssetBundle,with its dependencies,from local or remote location.Asset Dependency Management including BundleManifest that keep track of every AssetBundle and all of their dependencies. An AssetBundle Simulation Mode, which allows for iterative testing of AssetBundles in a the Unity editor without ever building an AssetBundle.

    For tutorials,examples and support,please see the project.

    Check it out here.
    https://assetstore.unity.com/packages/slug/87419

    Tested in Unity 3D on the following platforms:
    PC/Mac/Linux
    Android
    IOS
    UWP(Windows 10)
    WebGL

    Key features:
    - Build AssetBundle;
    - Encrypts/decrypts the file data of the AssetBundle;
    - Support AssetBundle simulation mode;



    For More Information Contact Us at: yangpc.china@gmail.com
     
  2. Futuregen_Digital

    Futuregen_Digital

    Joined:
    Dec 21, 2015
    Posts:
    1
    Where do I specify which folder to build?
     
  3. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Hi,you can only build the entire project,the unity3d does not support building a single folder.
     
  4. Hiroszan

    Hiroszan

    Joined:
    Dec 9, 2015
    Posts:
    1
    Many warnings occur immediately after import. It is a commercial package, so please arrange these things.


    Code (CSharp):
    1. [Warning] [Compiler] [None] [CS0618] `UnityEngine.WWW.size' is obsolete:
    2. `WWW.size is obsolete. Please use WWW.bytesDownloaded instead'
    3. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.AsyncResult.log' is assigned but its value is never used
    4. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.AsyncResult<TResult>.log' is assigned but its value is never used
    5. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.ProgressResult<TProgress,TResult>.log' is assigned but its value is never used
    6. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.Synchronizable.log' is assigned but its value is never used
    7. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.Synchronizable<TResult>.log' is assigned but its value is never used
    8. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Bundles.BundleManifestLoader.log' is assigned but its value is never used
    9. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.TypeExtensions.log' is assigned but its value is never used
    10. [Warning] [Compiler] [None] [CS0219] The variable `totalDataSize' is assigned but its value is never used
    11. [Warning] [Compiler] [None] [CS0219] The variable `headerSize' is assigned but its value is never used
    12. [Warning] [Compiler] [None] [CS0219] The variable `fileSize' is assigned but its value is never used
    13. [Warning] [Compiler] [None] [CS1717] Assignment made to same variable; did you mean to assign something else?
    14. [Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Bundles.Archives.AssetBundleArchive._lock' is assigned but its value is never used
    15. [Warning] [Compiler] [None] [CS0649] Field `Loxodon.Framework.Bundles.Editors.RedundancyAnalysisPanel.BUNDLE_ROOT_KEY' is never assigned to, and will always have its default value `null'
    16. [Warning] [None] [None] A polygon of TankTurret is self-intersecting and has been discarded.
    17. [Warning] [None] [None] A polygon of TankTurret is self-intersecting and has been discarded.
    18. [Warning] [None] [None] Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data.  Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    19. [Warning] [None] [None] Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data.  Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    20.  
     
  5. icatt23

    icatt23

    Joined:
    Feb 18, 2014
    Posts:
    5

    @Hiroszan - Were you able to fix those Warnings? If so, would you recommend? Thanks.
     
  6. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Hi, thank you for the report, I will fix it in the next version.
     
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,177
    Hi, I have a HUGE project that I would like to switch to asset bundles, I am wondering if this tool can handle that easily and automatically ? Or do I have to drag and drop each resource to the bundles etc? I need something which will detect all the assets for me, rather than manual dragging etc. Thanks.
     
  8. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Hi,this plugin automatically manages AssetBundle's dependencies and loads assets.It can also analyze redundant assets in Assetbundles,but he can't help you mark the name of the AssetBundle, you can look at "AssetBundles-Browser", maybe it can solve your problem. (https://github.com/Unity-Technologies/AssetBundles-Browser)
     
  9. iteco

    iteco

    Joined:
    Apr 2, 2019
    Posts:
    6
    How can I check the Asset Bundle file for damage? Get the CRC or hash of a real file that is in the cache. And then compare it with the value from the manifest file, if it does not match, download again.

    UPD Solved.
    Since I did not find how Unity calculates the CRC, I used CRC32 from "Ionic" instead of BuildPipeline.GetCRCForAssetBundle (file.FullName, out crc) in the BundleBuilder.CreateBundleInfo method.

    Verify in the DoAnalyzeDownloadList method:

    Code (CSharp):
    1. if (BundleUtil.Exists(info) && EqualCRC(info))
    2.   continue;
    P.S. Checking the CRC that is implemented in the unity does not work correctly. After changing 1 byte at the end of the file — GetAssetBundle considers the file to be correct and tries to load it from the cache, despite the fact that the CRC has changed.
     
    Last edited: Aug 25, 2019
  10. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    There is a crc check when loading assetbundles in unity3d, but this feature has bugs.At some point, the hash code has not changed, but the crc has changed, which will cause the loading of this assetbundle to fail,so when loading the assetbundle, the crc check is discarded.In our game, there are millions of users, it works very well.

    If you need to verify the crc code when downloading resources, this feature requires you to implement it yourself, you can not use the unit3d's crc code.
     
  11. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    If you need to implement the function of crc check when downloading files.You can inherit the interface "IBundleModifier", create a class, for example: CRCBundleModifier, calculate the crc code of bundleData.Data, append it to the end of the bundleData.Data array or save it in bundleData.BundleInfo,then add CRCBundleModifier to the modifier chain, see the function below.

    upload_2019-8-26_11-40-27.png
     
    iteco likes this.
  12. iteco

    iteco

    Joined:
    Apr 2, 2019
    Posts:
    6
    I can't downloading asset bundles from a remote server on WebGl platform? Only work with "StreamingAssets" folder without runtime download?
     
  13. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Whether you are a local folder or a remote server address, you can download them, please take a look at the source code
     
  14. iteco

    iteco

    Joined:
    Apr 2, 2019
    Posts:
    6
    I apologize for asking stupid questions. If there was good documentation or working example, I would not do it.

    Downloading bundles - OK, they are downloading. But when I try to read them from IndexedDB by Method manifestLoader.LoadAsync(BundleUtil.GetStorableDirectory() + BundleSetting.ManifestFilename)
    (file: ///idbfs/50e63f77e4128fe79bbe365389786f57/bundles/manifest.dat), I get a response from the Chrome browser:Access to XMLHttpRequest at 'file:///idbfs/50e63f77e4128fe79bbe365389786f57/bundles/manifest.dat' from origin 'http://myhost' has been blocked by CORS policy

    Or error "Not allowed to load local resource" in another browser
     
  15. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Is your game address and resource address not the same domain name? Please use Google to search for "CORS policy", you can find a solution.

    On the webgl platform, you should put resources in the streamingAssets folder, which is an Internet address and does not have cross-domain access restrictions.
     
  16. g-ulucay

    g-ulucay

    Joined:
    Jul 30, 2014
    Posts:
    5
    Hi, When i run tools/Build Asset, manifest.dat file everytime include below prefabs list but my prefabs couldn' list csv file or manifest.data how can i get my prefabs from url. I don't understand how to do it? Please help me? CSV File everytime shows below list. "encrypted/tanks/models","02e5ea750d34ededc02d1f3f4c94cbe4","1491465222","231796","","True","encrypted/tanks1/models","ADDED" "encrypted/tanks/prefabs","ac97bc12a12d34142ab93ea722ef6f3c","3719050950","2669","","True","encrypted/tanks1/prefabs","ADDED" "models/green","431eee90dfb90c2b29831c13a18f2ed0","3376928885","27352","","True","models/green","ADDED"
     
  17. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Before building, you should set the AssetBundle name for your prefabs or folders.
    Please see the chapter on Assetbundle in the official documentation for Unity3d.


    upload_2019-11-19_19-58-20.png
     
  18. dnomn8r

    dnomn8r

    Joined:
    Nov 15, 2012
    Posts:
    7
    Just wanted to let you guys know of a fairly serious issue.

    If you are in, let's say a pause menu, where Time.timeScale = 0, the asset loader breaks pretty thoroughly.

    This is because PriorityTaskExecutor.cs uses the following:


    Code (CSharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6.  
    7. using Loxodon.Framework.Execution;
    8.  
    9. namespace Loxodon.Framework.Bundles
    10. {
    11.     public class PriorityTaskExecutor : ITaskExecutor
    12.     {
    13.         private const int DEFAULT_MAX_TASK_COUNT = 6;
    14.         private readonly static WaitForSeconds waitForSeconds = new WaitForSeconds(0.1f);
    15.         private readonly static ComparerImpl<ITask> comparer = new ComparerImpl<ITask>();
    16.  
    17.  
    But it really should be:

    Code (CSharp):
    1.     private readonly static WaitForSecondsRealtime waitForSeconds = new WaitForSecondsRealtime(0.1f);

    If you don't, it will hang forever in the coroutine.
     
    Last edited: Apr 17, 2020
  19. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Thank you very much, I will fix it in the next version.
     
  20. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    I got error after update to version 1.9.6.

    Assets\LoxodonFramework\Scripts\Framework\Bundles\Simulation\SimulationResources.cs(37,40): error CS0103: The name 'EditorSceneManager' does not exist in the current context

    Snipaste_2020-07-22_17-44-58.png
     
  21. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    Thank you!

    At the head of the file, "using UnityEditor.SceneManagement;" is missing

    I will fix it in the next version.
     
  22. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    Once in a while when download patch asset bundles, the download speed is 0KB/S.
    How to deal with this matter?
    I try call downloadResult.Cancel(),
    1st, this.cancelable will be false, so Cancel() will not affect.
    2nd, I change this.cancelable to true in bugging ,but will get another error.

     
    Last edited: Jul 23, 2020
  23. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    According to this log file, it is because the file is locked by another process.
    The download does not show the progress, it is probably due to the network, the progress is provided by UnityWebRequest.

    When the download progress is 0, please check if there is any exception.

    IProgressResult<Progress, bool> result = downloader.DownloadBundles();
    Debug.LogErrorFormat("{0}",result.Exception)
     
  24. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    The issue is when the download Progress up to 99.9%, and the download speed from xxxKB/S Drop to 0KB/S.
    Some times wait about 5~10s, it will resume the download.
    Some times endless download speed is 0KB/S.
    The DoDownloadBundles state is still in downloadResult.Callbackable().OnProgressCallback.
    So I try downloadResult.Cancel() to change state to restart download.

    The downloadResult.Exception seems is null.
     
  25. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    You can print the log in the code below to see the progress.
    The Cancel function is not implemented, you should see a NotSupportedException.

    upload_2020-7-23_15-5-29.png
     
  26. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    Some times I build asset bundle for Android, but put the files to wrong folder for iOS.
    Will get error about:
    The file can not be loaded because it was created for another build target that is not compatible with this platform.
    Does possible check the asset bundle's build platform is wrong, and then clear the asset bundle files from StorableDirectory?
    Then I can let the game restart and ReDownload patch again.
     
  27. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    1、Upgrade the resource version number of the game
    2、download the new version of the resource
    3、call BundleUtil.EvictExpiredInStorableDirectory() function to clear the old version of the resource
     
    Timmy-Hsu likes this.
  28. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    1.
    After upgrade to version 1.9.9.
    I encounter an issue.
    When an Atlas enable include in Build and also set as a AssetBundle.
    A sprite is in the Atlas.
    A sprite in direct drag to Image on UI, then build APK test on device.
    A sprite will only show purple color textue.
    Don't known why...
    I create a new project, but can't reproduce.
    So I rollback to 1.9.8.

    2.
    Will Loxodon Framework Bundle support Google Play Asset Delivery ?
    Or Could you give me some suggestions to support it?
     
  29. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    27
    1. You try to rebuild all AssetBundles, does it solve the problem? I think upgrading the version to 1.9.9, it should not cause such an error.

    2. Google Play Asset Delivery is a unique feature of Google, it only supports OBB files.

    You can put all or part of AssetBundles in the StreamingAssets folder, and then check the "Split Application Binary" option.

    upload_2021-3-3_18-22-22.png

    Add macros “IONIC_ZIP” to the project,make sure FileUtil.IonicZip.cs is valid, it can help you read resources from the OBB file.

    upload_2021-3-3_18-39-17.png
     
    Timmy-Hsu likes this.
unityunity