> For the complete documentation index, see [llms.txt](https://mtgmodders.gitbook.io/etg-modding-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mtgmodders.gitbook.io/etg-modding-guide/misc/making-asset-bundles.md).

# Making Asset bundles

### Difficulty: 5/10 <img src="/files/-MfzUfwEbw3CPleihZ-O" alt="" data-size="original">&#x20;

Making asset bundles are a way to use real prefabs in gungeon.&#x20;

## Creating Asset Bundles

You need to download unity and download version 2017.4.40 so that the asset bundles you make are compatible with gungeon. <br>

They can be located here:

{% embed url="<https://unity3d.com/get-unity/download/archive>" %}

Create a new folder called Editor:<br>

![](/files/-MfzjreoszBr_uzslFct)

And inside the floder create a c# script and call It CreateAssetBundles.\
To do this right click and select create>C# script

![](/files/-Mfzk9AG-JlzynJrfAZP)

![](/files/-MfzkEA1TjQJz_xpRlNp)

Now open the script and paste this code in:

```csharp
using UnityEngine;
using UnityEditor;
using System.IO;
using UnityEngine.UI;

public class CreateAssetBundles
{
    [MenuItem("Assets/Build AssetBundles")]
    static void BuildAllAssetBundles()
    {
        string assetBundleDirectory = "Assets/StreamingAssets";
        if (!Directory.Exists(Application.streamingAssetsPath))
        {
            Directory.CreateDirectory(assetBundleDirectory);
        }
        BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
    }
}
```

Go back to the assets folder and create a new folder called BundledAssets, this will contain all the gameobjects, textures, etc.\
\
select the object you want to be part of the asset bundle and go to the bottom of the inspector panel

create a new assetbundle

![](/files/-MfzlFDByHRw2TYOamR3)

![](/files/-MfzlAzs9r_gtzNPm7Ha)

and then any object you want in the assetbundle will go under the one you made.

click the assets tab at the top left and go to the bottom where it says build assetbundles.

## Loading the AssetBundle&#x20;

in your mod drop this file in.

{% file src="/files/-Mfzln80wUV3sUl\_lXLj" %}

in your module add\
`public static AssetBundle ModAssets;`

before you load anything from this asset bundle do \
`ModAssets = AssetBundleLoader.LoadAssetBundleFromLiterallyAnywhere("assetbundlename");`&#x20;

## Loading objects from the AssetBundle

to load an object use \
`ModAssets.LoadAsset<ObjectType>("object name");`

for example, if it's a gameObject use

`ModAssets.LoadAsset<GameObject>("object name");`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mtgmodders.gitbook.io/etg-modding-guide/misc/making-asset-bundles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
