-------------------------------------------------------------------------------
Condor - Unity asset manage library by using assetbundle.
-------------------------------------------------------------------------------
Manage asset load and unload
Snapshot to report asset leak problem
100% source code included
Core code is covered by unit test. You could change code to customize it with more confidence
Feature
Use reference count to solve memory leak problem(Use AssetBundle.Unload(true) to unload asset deterministic)
Use AssetBundle reference count to solve AssetBundle dependencies problem(make sure all dependencies are loaded in correct sequence)
Use non-blocking call to solve hiccup problem(remove all hiccups which could avoid, mitigate load in main thread)
Use state matchine to solve cache problem(make asset stay in memory for seconds when reference count is 0)
Use weak reference to solve memory leak caused by library self(stop GC to recollect memory)
Automatic manage asset bundle dependencies, you could split asset bundle arbitrarily
Scene load in Editor helper script, help load scene in simulate mode
Please register account after purchased and ask questions on http://forum.fastiterate.com/
-------------------------------------------------------------------------------
Introduction
-------------------------------------------------------------------------------
Supported versions
5.4.2f2
5.5.0f3
5.6.0f3
2017.1.0f3
2017.2.0f3
2017.3.0f3
2017.4.0f1
Supported platforms
iOS
Android
Windows Editor
macOS Editor
Build
Check cyclic reference
Report cyclic reference path to solve it easily
Check AssetBundleName confliction
Check if AssetBundleName is same with directory part of other AssetBundleName
Check CRC
Prevent Unity from using old AssetBundle by not calculate hash correctly
Happened several times in real project
AssetBundle is outdated and couldn't load now
Support delete asset bundle which didn't pass crc check and retry build all assetbundles with 5 times
Clean useless directories and files automatically
Clean before build
Clean before copy built assetbundles to StreamingAssets directory
AssetBundle copy to StreamingAssets
Only copy files which is updated
Cache MD5 caculation
cache file size, last modify time, AssetBundle CRC
Recalculate MD5 by checking cache validity to speed build
Automatic manage asset bundle dependencies, you could split asset bundle arbitrarily
Load
Non-blocking api to load asset and scene
Use reference count to manage asset and assetbundle
Reference is saved by weak reference, don't impede GC
Reference saved detailed information
Type, fullname including namespace
Path, if object is GameObject or Component
Callback, fullname including namespace
Count
AssetBundle dependencies automatic management
AssetBundle load crc check
Cache AssetBundle in StreamingAssets directory
File in Android APK load support
Cache asset when reference count is 0
Load queue to load asset from AssetBundle, default capacity is 5
Finite state machine manage lifecycle
Debug
UI
Assets
AssetPath
Client fullname
Callback fullname
Reference count
State
Bundles
Bundle
Reference count
State
Automatic adapte screen
Snapshot
Automatic compare two snapshot and warning if there is difference
Editor Support
Load assets and scenes without building assetbundles
Check if assetbundlename is set for correspond asset
Stop all threads after exit play mode to keep consistent
Shader reset tools
Shader would be missing if load assetbundle which built for non-editor platform
Should reset shader to editor version manually after load asset
Editor scene load helper
Load scene automatically in simulate mode
Helper
Preload manager support load file from zip and apk
Preload manager use custom thread pool to do IO operation
Compression format
LZ4
Use chunk-based algorithm to get balance on speed and size
Engineer
Unit test
Core code covered
Code clean and simple
Separate module reasonably
Use less code in module, about 100 loc per file
No explicit thread synchronization to avoid bugs
Third party libraries
Editor
YamlDotNet
Cache calculated MD5
NSubstitute
Unit test helper
Runtime
ZipStorer
Support decompress files on Android
Would not support
variant support
It violates design purpose, which could use path to determine asset
blocking load
It could cause potential hiccups in main thread
-------------------------------------------------------------------------------
Usage
-------------------------------------------------------------------------------
Run Tools > Condor > Setup to initilize, and create two config files
1 Runtime config, Assets/Resources/Condor/Config.asset
2 Editor scene config, Assets/Editor/Condor/SceneConfig.asset, we need save scenes manualy to this config to support load scenes in Editor simulate mode
Create or find your asset and set AssetBundleName for it.
Write code to initialize Condor.
Write code to load and unload your asset by using full asset path(starting with Assets).
Then you could test load asset when enable Editor Simulation in config.
Run Tools > Condor > BuildAssetBundles could build AssetBundles and copy to StreamingAssets directory.
Then you could load asset from assetbundles.
Build to iOS/Android platform and you could load asset from assetbundles packaged in ipa/apk.
-------------------------------------------------------------------------------
Precaution
-------------------------------------------------------------------------------
Unit test support is include in Unity 5.6.0f3 and above, which packaged NUnit 3.5.0.0 and previous ones package NUnit 2.6.4.0
HttpWebRequest Android IL2CPP support is started from Unity 5.4.2f2
Editor simulate load Bundle information is supported in Unity 5.5.0f3 and above
Editor simulate load scenes support load by path in Unity 5.5.0f3 and above, only support load by name in previous versions
-------------------------------------------------------------------------------
API interface
-------------------------------------------------------------------------------
Initialize and destroy
Condor.Manager.Init()
Condor.Manager.Destroy()
Load and Unload
Condor.Manager.LoadAsync()
Condor.Manager.UnloadAsync()
Clean cache
Condor.Manager.UnloadUnusedImmediately()
Snapshot
Condor.Manager.BeginSnapshot()
Condor.Manager.EndSnapshot()
-------------------------------------------------------------------------------
Examples
-------------------------------------------------------------------------------
Asset load
Condor/Examples/Scenes/Asset.unity
Scene load
Condor/Examples/Scenes/Scene.unity
Snapshot
Condor/Tests/IntegrationTests/Scenes/SnapshotIntegrationTests.unity
-------------------------------------------------------------------------------
Third party libraries
-------------------------------------------------------------------------------
Use YamlDotNet to deserialize AssetBundleManifest and caculate MD5.
YamlDotNet for Unity - Asset Store
https://www.assetstore.unity3d.com/en/#!/content/36292 - 4.1.0 (Feb 01, 2017)
MIT-LICENSE
Editor/Libraries/YamlDotNet/YamlDotNet.license.txt
Use NSubstitute to fake object for unit test.
NSubstitute: A friendly substitute for .NET mocking libraries
http://nsubstitute.github.io/ - 2.0.3 (Apr 25, 2017)
BSD-3-Clause
Editor/Libraries/NSubstitute/LICENSE.txt
Use ZipStorer to decompress files from zip or apk.
jaime-olivares/zipstorer: A Pure C# Class to Store Files in Zip
https://github.com/jaime-olivares/zipstorer - 3.4.0 (August 4, 2017)
MIT-LICENSE
https://github.com/jaime-olivares/zipstorer/blob/master/LICENSE.md