Closed DanielWillett closed 1 year ago
Just use the unity API to load asset bundle, https://docs.unity3d.com/ScriptReference/AssetBundle.LoadFromFileAsync.html .
If your bundle is big and want to show the progress bar to the user, then yeah, that may not work for you.
While DiFFoZ is correct that Unity asset bundles can be directly loaded, I agree this would be good to fix in case there is any existing content in the same situation. Thanks for the report!
Works now, thank you.
For a project I'm working on I have a masterbundle that is just treated as a kind of 'Resources' bundle and doesn't actually contain any assets. I've been trying to fix it for a while now and finally figured out why. If there are no assets queued by the reader thread, then the worker's
IsWorking
property is set to false inAssetWorker.Update
while the asset bundle request is still not done, which ends theLoadAssetsFromWorkerThread
coroutine before the bundle finishes loading. The bundle never gets removed from pending or loaded into the master bundle list.I believe an easy fix would just be to make this
while (worker.IsWorking || pendingMasterBundles.Count > 0)
With a test asset:
With no assets:
Note how the load start message (which is triggered from a prefix to
MasterBundleConfig.StartLoad
) gets displayed but the 'load end' message doesn't (triggered from a prefix toMasterBundleConfig.FinishLoad
).Edit: This is the coroutine I'm using to load the bundle