Loxodon Framework Bundle(AssetBundle)


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.

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

Where do I specify which folder to build?

Hi,you can only build the entire project,the unity3d does not support building a single folder.

Many warnings occur immediately after import. It is a commercial package, so please arrange these things.

[Warning] [Compiler] [None] [CS0618] `UnityEngine.WWW.size' is obsolete:
`WWW.size is obsolete. Please use WWW.bytesDownloaded instead'
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.AsyncResult.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.AsyncResult<TResult>.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.ProgressResult<TProgress,TResult>.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.Synchronizable.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Asynchronous.Synchronizable<TResult>.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Bundles.BundleManifestLoader.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.TypeExtensions.log' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0219] The variable `totalDataSize' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0219] The variable `headerSize' is assigned but its value is never used
[Warning] [Compiler] [None] [CS0219] The variable `fileSize' is assigned but its value is never used
[Warning] [Compiler] [None] [CS1717] Assignment made to same variable; did you mean to assign something else?
[Warning] [Compiler] [None] [CS0414] The private field `Loxodon.Framework.Bundles.Archives.AssetBundleArchive._lock' is assigned but its value is never used
[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'
[Warning] [None] [None] A polygon of TankTurret is self-intersecting and has been discarded.
[Warning] [None] [None] A polygon of TankTurret is self-intersecting and has been discarded.
[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.
[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.

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

Hi, thank you for the report, I will fix it in the next version.

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.

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)

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:

if (BundleUtil.Exists(info) && EqualCRC(info))
  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.

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.

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.

4895567--473360--upload_2019-8-26_11-40-27.png

1 Like

I can’t downloading asset bundles from a remote server on WebGl platform? Only work with “StreamingAssets” folder without runtime download?

Whether you are a local folder or a remote server address, you can download them, please take a look at the source code

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

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.

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”

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.

5190548--515867--upload_2019-11-19_19-58-20.png

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:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

using Loxodon.Framework.Execution;

namespace Loxodon.Framework.Bundles
{
    public class PriorityTaskExecutor : ITaskExecutor
    {
        private const int DEFAULT_MAX_TASK_COUNT = 6;
        private readonly static WaitForSeconds waitForSeconds = new WaitForSeconds(0.1f);
        private readonly static ComparerImpl<ITask> comparer = new ComparerImpl<ITask>();

But it really should be:

private readonly static WaitForSecondsRealtime waitForSeconds = new WaitForSecondsRealtime(0.1f);

If you don’t, it will hang forever in the coroutine.

Thank you very much, I will fix it in the next version.

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