> For the complete documentation index, see [llms.txt](https://starshooter.gitbook.io/architect/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://starshooter.gitbook.io/architect/architect-silksong/embedding-levels-in-mods.md).

# Embedding Levels in Mods

To add your own custom objects whilst also being able to use Architect's level editing features, you can embed Architect levels *inside* of your own mod, meaning that your custom map can load automatically when your mod is installed.

This is intended for developers who want to use Architect as a tool whilst still being able to include their own custom features, such as custom enemies.

If you simply want an easy way to share levels, the [in-game level sharer](/architect/architect-silksong/sharing-levels.md) is the best method to share your levels with others.

### Preparing the project

First, you need to add Architect as a dependancy in your mod. To do this, add the following line of code to your main class:

```
[BepInDependency("com.cometcake575.architect")]
```

Next, create a `Resources` folder in your project if you do not already have one, where you will later place the level files inside.

Now edit your .csproj file and add the following item group:

```
<ItemGroup>
  <EmbeddedResource Include="Resources/*.json"/>
</ItemGroup>
```

This will ensure any .json files inside your Resources folder are embedded inside your mod, and can be loaded by Architect.

### Embedding the level

Make your changes with Architect's in-game editor, then navigate to the Scenes folder. The location of this folder will vary depending on your operating system:

To do this, you can find the json files that store your edits in the Architect folder, located in the same folder as your save data.

This folder's location can differ depending on your device:

* Windows: `%AppData%..\LocalLow\Team Cherry\Hollow Knight Silksong\Architect\Scenes`&#x20;
* Mac: `~/Library/Application Support/unity.Team Cherry.Silksong/Architect/Scenes`&#x20;
* Linux: `~/.config/unity3d/Team Cherry/Hollow Knight Silksong/Architect/Scenes`&#x20;

The folder will contain one json file for each scene you have edited. Copy these to the Resources folder in your project.

* You can rename the level files if you want, but make sure to note down the scene names as they're needed to register the level.

### Registering the level

After the level files are embedded, you need to tell Architect to load them using the `LoadMap` method.

Replace `scene` in the following line with the scene the level is in, `name` with the file name and `CustomMapMod` with your mod's namespace.

```
MapLoader.LoadMap(Assembly.GetExecutingAssembly(), scene, "CustomMapMod.Resources.name.json");
```

Next, repeat this line for every scene file you want to register.

### Full main class example

```
[BepInPlugin("com.cometcake575.custommap", "Custom Map Mod Test", "1.0.0")]
[BepInDependency("com.cometcake575.architect")]
public class CustomMapModPlugin : BaseUnityPlugin 
{
    private void Awake()
    {
        MapLoader.LoadMap(Assembly.GetExecutingAssembly(), "Bonetown", 
            "CustomMapMod.Resources.Bonetown.architect.json");
        MapLoader.LoadMap(Assembly.GetExecutingAssembly(), "Bellway_01", 
            "CustomMapMod.Resources.Bellway_01.architect.json");
    }
}
```


---

# 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://starshooter.gitbook.io/architect/architect-silksong/embedding-levels-in-mods.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.
