Skip to content

Navigation Menu

Sign in
Sign up

Bundles

adamdev edited this page Dec 24, 2025 · 1 revision

Asset bundles are used by modders to add custom content to BONELAB. BoneLib provides functionality for handling asset loading (i.e. loading bundles that are embedded resources).

Bundles as Embedded Resources

Embedded resources is binary data that is baked into a code mod. Loading bundles from an embedded resource is trivial.

Assembly assembly = Assembly.GetExecutingAssembly();
AssetBundle bundle = BoneLib.HelperMethods.LoadEmbeddedAssetBundle(assembly, "MyMod.CustomBundle");

Persistent Assets

Any object loaded from an asset bundle will be cleaned up when you enter a new scene. This is not what you want if you're trying to keep assets past the initial loading screen.

To keep your objects persistent in memory, simply use HelperMethods.LoadPersistentAsset<T>, where T can be an AudioClip, GameObject, or whatever it is you're loading!

Assembly assembly = Assembly.GetExecutingAssembly();
AssetBundle bundle = BoneLib.HelperMethods.LoadEmbeddedAssetBundle(assembly, "MyMod.CustomBundle");
// Load a texture from the bundle and make it persistent
Texture2D myTexture = bundle.LoadPersistentAsset("MyTexture");

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /