Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    41

    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. unity_futuregen

    unity_futuregen

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

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    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:
    41
    Hi, thank you for the report, I will fix it in the next version.
     
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    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:
    41
    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:
    41
    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:
    41
    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:
    41
    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:
    41
    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:
    41
    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:
    12
    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:
    41
    Thank you very much, I will fix it in the next version.
     
  20. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    51
    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:
    41
    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:
    51
    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:
    41
    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:
    51
    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:
    41
    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:
    51
    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:
    41
    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:
    51
    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:
    41
    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.
  30. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    51
    1. I try upgrading the version to 1.9.9,and rebuild all AssetBundles again.
    I encounter same issue.
    The issue I description is not correct.
    The issue is A sprite total not displayed on device.
     
  31. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41

    Could you give me a demo that can reproduce this issue and send it to my email yangpc.china@gmail.com.
     
  32. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    51
    1.I create a new project, but can't reproduce now..
    If I reproduce the issue, I will send the demo to your email.

    2.https://developer.android.com/guide/app-bundle
    From August 2021, new apps will be required to publish with the Android App Bundle on Google Play.

    Android App Bundle can't use with OBB files.
    Android App Bundle only can use Google Play Asset Delivery.....
     
  33. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41

    This plugin only helps you load AssetBundle and manage dependencies, it doesn’t care about where you download AssetBundle from.
     
  34. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Here is how to do it:
    https://developer.android.com/guide/app-bundle/asset-delivery/build-unity
     
  35. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    51
    Hi,
    I create new project to try reproduce the issue.
    I send the project to you.
    Not sure whether or not the issue is unity bug.

    Demo is use version 1.9.8, seems also has the issue.
    Maybe the issue is unity bug.
     
    Last edited: Mar 11, 2021
  36. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
    Hello, I'm trying to use Loxodon with webgl.
    It's a testing webgl project in unity 2019.4.18
    I build the AssetBundles and run the scene, it works in editor. But after build and test in browser there are errors like below.
    Any idea how to make it work?

    QQ截图20211209164745.png QQ截图20211209164717.png
     
  37. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Please use the following example, it can work on the webgl platform

    upload_2021-12-9_17-19-2.png
     
  38. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
    My test is already in that example scene.
     
  39. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
    QQ截图20211209174909.png
    The earlier screenshots are based on the build of this default scene already
     
  40. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
  41. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
    No any modification.
    I just PM you the link of the project, you can take a look if you're interested. I tested in unity 2020 the result is the same.
     
  42. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Unity 2020.3.7f1
    Loxodon.Framework.Bundle 2.0.3

    upload_2021-12-9_18-10-12.png

    upload_2021-12-9_18-7-37.png
     
  43. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
  44. ryanflees

    ryanflees

    Joined:
    Nov 15, 2014
    Posts:
    59
    Ok, I just established the build on the local nginx service. and it works right now.
    It doesn't work via direct run with browser, I'm new to webgl and wasn't aware of that. Thanks for the help.

    QQ截图20211209192405.png
     
  45. Pingquin

    Pingquin

    Joined:
    Oct 2, 2013
    Posts:
    12
    Hi, As for the WebGL build, I used DownloadExample scene with some modification to make it works with WebGL. After hit "Download AssetBundle", there's an error for all files that got downloaded. However, everything work just fine! all files are downloaded and asset can be loaded into the scene.
    What cause this and how to fix it?

    FileNotFoundException: /idbfs/f0cf2038657a60f9208e9d7b3cb31f69/bundles/encrypted/tanks/models.tmp does not exist
    at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <00000000000000000000000000000000>:0
     

    Attached Files:

    • tmp.png
      tmp.png
      File size:
      66.8 KB
      Views:
      234
  46. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    Please use the hash file name
     
  47. Pingquin

    Pingquin

    Joined:
    Oct 2, 2013
    Posts:
    12
    I tried changing to hash file name and it still be the same error, the difference is the file name changed to hash.
    I also tried with 2 difference bundle build settings both gave the same error.
    my Unity version is 2020.3.26f1

    FileNotFoundException: /idbfs/f0cf2038657a60f9208e9d7b3cb31f69/bundles/77e5d72467409a4ab9f979dfa38a612a.tmp does not exist
    at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <00000000000000000000000000000000>:0
     

    Attached Files:

    • ab.png
      ab.png
      File size:
      53.7 KB
      Views:
      239
    • set1.png
      set1.png
      File size:
      27 KB
      Views:
      237
    • set2.png
      set2.png
      File size:
      33 KB
      Views:
      240
    Last edited: Feb 7, 2022
  48. skymeson

    skymeson

    Joined:
    Sep 30, 2016
    Posts:
    15
    This is probably a pretty basic question, but I can only get the LoadSceneExample working if I copy the asset bundles to StramingAssets folder. Where do I change the settings to download from a server?
     
  49. LoxodonStudio

    LoxodonStudio

    Joined:
    Nov 1, 2016
    Posts:
    41
    There are examples in the project.

    upload_2023-1-16_13-27-33.png
    upload_2023-1-16_13-26-8.png
     
  50. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    51
    Hi,

    I find an issue.
    If the file is not at the target URL when downloading, there will not show any warning or error, it will show success without going to the exception.

    Snipaste_2023-05-30_16-29-27.jpg

    The file will remain in a temp file.
    Snipaste_2023-05-30_16-30-00.jpg

    Code (CSharp):
    1. IProgressResult<Progress, bool> downloadResult = this.m_Downloader.DownloadBundles(bundles);
    2.         downloadResult.Callbackable().OnProgressCallback(p =>
    3.         {
    4.                 UnityEngine.Debug.LogFormat("Downloading {0:F2}KB/{1:F2}KB {2:F3}KB/S", p.GetCompletedSize(UNIT.KB), p.GetTotalSize(UNIT.KB), p.GetSpeed(UNIT.KB));
    5.         });
    6.         downloadResult.Callbackable().OnCallback(p =>
    7.         {
    8.             try
    9.             {
    10.                 if (p.Exception != null)
    11.                     throw p.Exception;
    12.  
    13.                 UnityEngine.Debug.LogFormat("Downloading {0:F2}KB/{1:F2}KB {2:F3}KB/S", p.Progress.GetCompletedSize(UNIT.KB), p.Progress.GetTotalSize(UNIT.KB), p.Progress.GetSpeed(UNIT.KB));
    14.  
    15.                 if (p.Result)
    16.                 {
    17.                     if (p.IsDone)
    18.                     {
    19.                         m_IsDownloadComplete = true;
    20.                         UnityEngine.Debug.Log("Downloads AssetBundle Complete!");
    21.                     }
    22.                 }
    23.             }
    24.             catch (Exception e)
    25.             {
    26.                 Debug.LogErrorFormat("Load failure.Error:{0}", e);
    27.             }
    28.         });