A handly tool for building, managing, downloading AssetBundle
- Add assets to AssetBundle with one click (select folder or select assets)
- Remove assets from AssetBundle with one click (select folder or select assets)
- Manager AssetBundle file and Build AssetBundle with ecrypted mode or non-encrypted mode in editor mode
- Download Assetbundle, manage and check new version of AssetBundle file
- Unity 5.4
- Unity UGUI to create sample UI
- EditorGUILayout, GUILayout... to create AssetBundle Window editor, Encrypt files in Folder window
- WWW to handle with download AssetBundle
- Free character, effect, scene at Unity Asset Store
- msgpack-unity (https://github.com/masharada/msgpack-unity) to save and load AssetBundle database
- Please create one folder for storing all assets that needed to become AssetBundle under
Assets/
path. Like:Assets/AssetBundleResources
- And move all assets that needed to become AssetBundle to this folder. Like: https://gyazo.com/7a717c46e79d38406cb6edc1dd2e5acc
Assets/AssetBundleResources/Characters/Minotaur.prefab
Assets/AssetBundleResources/Effects/Snow.preafb
Assets/AssetBundleResources/Weapon/weapons_a.preafb
Assets/AssetBundleResources/Weapon/weapons_b.preafb
Assets/AssetBundleResources/Weapon/weapons_c.preafb
- Select Folder that contain Assets (or Assets) needed to become AssetBundle
Right click / AssetBundle Tool/ Add To AssetBundle
-> DONE!
https://gyazo.com/caeca9ff703fcac602f6eafad6d70403
- Select Folder that contain Assets (or Assets) needed to remove from AssetBundle
Right click / AssetBundle Tool/ Remove From AssetBundle
-> DONE!
https://gyazo.com/caeca9ff703fcac602f6eafad6d70403
3. Manager AssetBundle file and Build AssetBundle with ecrypted mode or non-encrypted mode in editor mode
- Go
Tools/ AssetBundle Tool/ AssetBundle Window
to open AssetBundle Manager Window (https://gyazo.com/95caeb73757869b4f08cbc3961ac6d19) - At Assetbundle Manager Window, there are two area:
BUILD ASSETBUNDLE
andRESOURCES'S DETAIL
(https://gyazo.com/e95413e0c72ee08cc7741eaf69541811)
Used to build assetbundle
Export path
: Where built assetbundle will be exportedFile extention
: file extension. Like: *.unity3d or *.abc, *.somethingBuild Target
: Select target. iOS or Android or StandAlone...- Encrypt Assetbundle by select
Encrypt AssetBundle
and input password.
https://gyazo.com/9ff0c040ed8b26fbc07102f2b85e592d
There are two option for setting password.Load from setting
orRandom
Load from setting
OpenAssetBundleSettings.cs
and findPASSWORD_ENCRYPT_DECRYPT_ASSETBUNDLE
to setup passwordRandom
:
Just click to it. It will generate random password with lenght in range 8-30 characters
- When you are ready for building AssetBundle, Just click
Build AssetBundle
and wait
Building: https://gyazo.com/755ae75ce63dcc3da43435d97e39411c
Success: https://gyazo.com/df52a5e96f58f87fc6681792b2fa6a80
Export folder:https://gyazo.com/6509f9a80823d087db7ee3fbcc075a81
Note: All of default setting were setted inAssetBundleSettings.cs
. Please edit it to change default setting.
Manager AssetBundle file by version, filesize, dependencies of AssetBundle file
https://gyazo.com/073057cc5295f7d7231e73dd2884466f
- Refresh Data
Refresh data when new file was add or remove from AssetBundle - Clear Local Database
ABTool create local database to manager AssetBundle and version. So we can clear it and create new. Just carefully! - Open Saved AssetBundle Folder
Open Local storage at editor mode to check something ... - Assets in AssetBundle
https://gyazo.com/410437539f0de8fb2000e61a87e9470c
When a new file was added to AssetBundle, this window will show a list of files were added to AssetBundle. It show file path, size of file.. We can sort by size to optimize file.. Just click to cell in list to focus to object. - Prebuild AssetBundle Information
https://gyazo.com/d2f575e41f194d367039fbff87ae6c7a
Show list of AssetBundle file. File was added to AssetBundle, Dependencies and size of file.
At this window, we can remove file that no need to be built - Local AssetBundle Database
https://gyazo.com/27c09c925608f6db22e9aeab7e512a4f
Manager built AssetBundle, size and version of AssetBundle
Open MenuScene
in this project to know how to download AssetBundle
https://gyazo.com/03bb8d02a6b257528d694f370aeedb5a
There are two mode: Local or Remote server
- Local test (Load AssetBundle from StreamingAssets Folder)
- Go to
AssetBundleSettings.cs
, setIsStreamingAssetsFolderLoad
totrue
- Copy your exported folder to StreamingAssets Folder
- https://gyazo.com/e5d33e57fe72d046eeec00ad036477ff
- Remote server
- Please upload exported folder to your host server. For ex: "http://10qpalzma.000webhostapp.com/"
- Go to
AssetBundleSettings.cs
. setIsStreamingAssetsFolderLoad
tofalse
, sethostURL= your_host_server
. For ex: "http://10qpalzma.000webhostapp.com/"
- Download All AssetBundle
IEnumerator DownloadAllAssetBundles(Action onFinish) {
bool isFinishDownload = false;
bool isSuccess = false;
_txtDownloadProgress.text = "Processing...";
StartCoroutine(AssetBundleManager.Instance.DownloadAssetBundlesFromServer (
()=>{
isFinishDownload = true;
isSuccess = true;
},
(error)=>{
isFinishDownload = true;
isSuccess = false;
Debug.Log("Error " + error);
}));
while (!isFinishDownload) {
//Update progess
if (AssetBundleManager.Instance.totalAssetBundleFilesNeedDownload > 0) {
_txtDownloadProgress.text = "Processed: " + AssetBundleManager.Instance.totalDownloaded + "/" + AssetBundleManager.Instance.totalAssetBundleFilesNeedDownload;
_txtDownloadProgress.text += " " + AssetBundleManager.Instance.downloadedSize + "B / " + AssetBundleManager.Instance.totalSize + "B";
}
yield return null;
}
if (isSuccess) {
onFinish ();
}
}
- Load Object
//Load Character
string assetbundle = "assets/examples/assetbundleresources/characters/minotaur";
AssetManager.Instance.GetAssetBundle<GameObject> (assetbundle,
(obj)=>{
GameObject chaObj = GameObject.Instantiate(obj, _unitRoot.transform) as GameObject;
chaObj.transform.localPosition = Vector3.zero;
}, (err)=>{
Debug.Log(err);
});
//Load effect
string assetbundle = "assets/examples/assetbundleresources/effects/snow";
AssetManager.Instance.GetAssetBundle<GameObject> (assetbundle,
(obj) => {
GameObject effect = GameObject.Instantiate(obj, this.transform) as GameObject;
effect.name = obj.name;
}, (err) => {
Debug.Log(err);
});
- Load Scene
string assetPath = "assets/examples/assetbundleresources/scene/camfirescene";
UnityEngine.SceneManagement.LoadSceneMode loadSceneMode = LoadSceneMode.Single;
StartCoroutine (AssetBundleManager.Instance.LoadSceneAsync (assetPath, loadSceneMode, onFinish, onFailed));