lc-sigurd / sigurd

Sigurd, the Lethal Company Library.
GNU Lesser General Public License v3.0
3 stars 1 forks source link

Improve BundleAPI #2

Open Lordfirespeed opened 7 months ago

Lordfirespeed commented 7 months ago

As it stands, BundleAPI doesn't provide a significant improvement over using Unity's API directly.

However, that isn't to say it has no value.

Could we provide one-liners?

E.g exposed API

var prefab = await LoadBundleAsset<GameObject>(path, "Assets/Prefabs/whatever.prefab");

Which would be equivalent to

var bundle = AssetBundle.LoadFromFile(path)
bundle.LoadAsset<GameObject>("Assets/Prefabs/whatever.prefab");
bundle.Unload(false); // unload bundle but not assets

Could we provide asynchronous alternatives?

We could use UniTask to provide efficient and thread-safe asynchronous bundle-loading.