sadpandastudios / assetbundlemanager Goto Github PK
View Code? Open in Web Editor NEWAn asset bundle manager for Unity.
License: MIT License
An asset bundle manager for Unity.
License: MIT License
Hi,
I am trying to use asset bundles from StreamingAssets folder on Android.
You can see above how I built and the resulting files.
When I start the app and investigate logcat, it says :
Error Unity Unable to open archive file: jar:file:///data/app/com.a.b-1/base.apk!/assets/Android/Android
Warn Unity Unable to retrieve manifest file [jar:file:///data/app/com.a.b-1/base.apk!/assets/Android/Android] from StreamingAssets, disabling StreamingAssetsBundleDownloadDecorator.
...
And also I see that when I extract the apk:
Is there a problem with my file hierarchy?
PS: Thanks for the awesome library!
Hi,
We are still using this asset, thanks again!
We are building and uploading our ABs using Unity Cloud (in the Post Process step).
It seems that if we build the ABs with "Windows 64" as the build target the output folder is named StandaloneWindows64
, same for the manifest.
private static void BuildAssetBundles() {
var buildPath = GetAssetBundleFolder();
if (Directory.Exists(buildPath)) {
Directory.Delete(buildPath, true);
}
Directory.CreateDirectory(buildPath);
// Build asset bundles for the current platform
BuildPipeline.BuildAssetBundles(buildPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
}
private static string GetAssetBundleFolder() {
return "Assets/StreamingAssets" + "/" + EditorUserBuildSettings.activeBuildTarget;
}
But ofc in AssetBundleUtility.GetPlatformForAssetBundles
the bundle name is always set to StandaloneWindows
and not StandaloneWindows64
.
Not quite sure what to make of that, the best solution would probably be to rename the output folder and manifest during Cloud Build for the windows 64bit target.
Or we could check if windows is 64bits at runtime using this method and select the appropriate bundle name.
When download bundle from different script , does very script have to has it own abm, and initialize ,then download bundle from server or cache, can you provide an ABM singleton can initialize once and directly load bundle ?
Hello,
Thanks for your great lib, it helps us a lot on our project. :)
I may have found a little issue and wanted to share:
If I await GetBundle
for a nonexistent bundle, the Task is never completed and the awaits get stucks.
(Found this in a unit test)/
The code to reproduce is just:
AssetBundle bundle = await assetBundleManager.GetBundle("thisbundledoesntexists");
Diving into your code, I think the issue is in AssetBundleDownloader#Download
Replacing
if (isHttpError) {
Debug.LogError(string.Format("Error downloading [{0}]: [{1}] [{2}]", uri, req.responseCode, req.error));
if (retryCount < MAX_RETRY_COUNT && RETRY_ON_ERRORS.Contains(req.responseCode)) {
Debug.LogWarning(string.Format("Retrying [{0}] in [{1}] seconds...", uri, RETRY_WAIT_PERIOD));
req.Dispose();
activeDownloads--;
yield return new WaitForSeconds(RETRY_WAIT_PERIOD);
InternalHandle(Download(cmd, retryCount + 1));
yield break;
}
}
AssetBundle bundle;
if (isNetworkError) {
Debug.LogError(string.Format("Error downloading [{0}]: [{1}]", uri, req.error));
bundle = null;
} else {
bundle = DownloadHandlerAssetBundle.GetContent(req);
}
By
AssetBundle bundle = null;
if (isHttpError) {
Debug.LogError(string.Format("Error downloading [{0}]: [{1}] [{2}]", uri, req.responseCode, req.error));
if (retryCount < MAX_RETRY_COUNT && RETRY_ON_ERRORS.Contains(req.responseCode)) {
Debug.LogWarning(string.Format("Retrying [{0}] in [{1}] seconds...", uri, RETRY_WAIT_PERIOD));
req.Dispose();
activeDownloads--;
yield return new WaitForSeconds(RETRY_WAIT_PERIOD);
InternalHandle(Download(cmd, retryCount + 1));
yield break;
}
}
else
{
if (isNetworkError)
{
Debug.LogError(string.Format("Error downloading [{0}]: [{1}]", uri, req.error));
bundle = null;
}
else
{
bundle = DownloadHandlerAssetBundle.GetContent(req);
}
}
was enough to make sure the task is always complete even if the bundle is null. Otherwise, we have an http error but not a network error and it calls DownloadHandlerAssetBundle.GetContent
and fails silently.
Cheers!
I believe the last release was in Oct 2020, hence I am assuming it is supported for Unity 2020. But what's the future support plan going ahead?
Looking at a proper AssetBundles framework, but noticed that it seems that Unity is re-architecting this into some sort of Addressables system in 2018.2
Are you planning to make this compatible with the current stable Unity version? https://forum.unity.com/threads/assetbundle-manager-deprecated.528334/
I tried to expose the download queue size to make download progress looks like:
current / total files to download
download progress %
but, i can't figure it out how to expose on the ABM class.
also, do manifest contain information for total file size (with dependency)?
Finally deleting specific assetbundle, it can be done with
Caching.ClearCachedVersion(assetbundleName, Hash128)
how to get the downloaded bundle's hash128?
or, is there another way to delete specific downloaded bundle?
Could you give me the explanation?
Thanks
Hi when I am in the middle of an asset download and i lose the internet connection, how can i continue or restart the asset download.
Currently it never triggers the OnBundleDownloaded or maybe i am doing it wrong. Can you help me with this.
Thanks
Hi, I have a question:
When uploading the asset bundle on server does it need to have all files that were generated or having just the .unity3d is enough?
I am planning of downloading the asset bundles into persistent path and load them from there, does that mean I have to tweak anything in your code?
For example=>I need to download the bundle from http://127.0.0.1/subgame.ab
Is that possible to use this library?
Thanks in advance.
This is AMAZING.
THANK YOU.
my mistake. test wrong way.
Hi,
I wanna first thank you for this project, it's indeed easier to use than Unity's abm, and I use it in my project. I had some question about how to config the ABM for this scenario.
our project use asset bundle browser to build asset bundles.
Q:
I try this code
abm = new AssetBundleManager(); abm.SetPrioritizationStrategy(AssetBundleManager.PrioritizationStrategy.PrioritizeStreamingAssets); abm.SetBaseUri(GameConfig.GetBaseURI());
I'm not sure it's going to work,
3.If I put the IOS, and IOS meanfest bundle in streammingAsset folder, when game start up, It should always to load the IOS ab from asset server, How can I make sure it work in this way when the network is connectable.?
sorry for ask so many questions in a time.
thanks
https://docs.unity3d.com/Manual/DomainReloading.html
This can be done by adding
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
private static void ResetOnPlay() {
instance = null;
}
to AssetBundleDownloaderMonoBehaviour
That should be enough !
Thanks in advance.
Добрый день. Я столкнулся с проблема при использовании менеджера. Скачивая пакеты с зависимостями в итоге скачиваются только те пакеты у которых не было зависимостей, а те пакеты у которых была хотя бы одна зависимость не скачиваются. Возможно вы сможете подсказать в чем проблема.
Good afternoon. I encountered a problem when using the manager. Downloading packets with dependencies eventually download only those packages that did not have dependencies, and those packets that have not been downloaded at least one dependence. Perhaps you can suggest a problem.
I'm trying load my datas but giving error. Error downloading [/Users/*/Desktop/Unity Projects//AssetBundles/Android/Android]: [Cannot connect to destination host] there are two android folder but I have one android folder. I did not understand what's going on
I am looking to get the download progress so I can show a progress bar (More than one bundle may be downloaded) to the user. Any tips where should I dig into to achieve this?
Hi,
There must be something im doing wrong.
Im building asset bundle with ABB, when I build the only thing I change is build target: Windows Standalone 64. I don't set the asset bundle name manually from (bottom right) so the ABB makes default name which is the same as the .obj name that i am using for testing.
The output path, i am not touching it and leave the default but the debug is giving me a different path somehow?? It out puts it in project root folder and not in Asset/... which is fine I don't care where the folder is, I tried in asset/AssetBundles as well and it still does not work.
see below image of my console:
this is the code taken from example except that i am only using the simulatedUri
` private AssetBundleManager abm;
// Use this for initialization
private void Start ()
{
abm = new AssetBundleManager();
if (Application.isEditor)
abm.UseSimulatedUri();
abm.Initialize(OnAssetBundleManagerInitialized);
}
private void OnAssetBundleManagerInitialized(bool success)
{
if (success)
{
abm.GetBundle("plot_02", OnAssetBundleDownloaded);
}
else
{
Debug.LogError("Error initializing ABM.");
}
}
private void OnAssetBundleDownloaded(AssetBundle bundle)
{
if (bundle != null)
{
// Do something with the bundle
abm.UnloadBundle(bundle);
}
abm.Dispose();
}`
Any help would be greatly appreciated
Hi, thank you for sharing your ABM
but there's a lot question i want to ask.
How to check if the bundle is already in cache?
and i'm a bit confused about how you compare the version? your code is using caching.IsVersionCached but how i get the Hash128 form AssetBundleDownloadCommand?
I want to make a list of downloadable content (with notification if the downloaded version is updated)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.