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 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

  • Mac: ~/Library/Application Support/unity.Team Cherry.Silksong/Architect/Scenes

  • Linux: ~/.config/unity3d/Team Cherry/Hollow Knight Silksong/Architect/Scenes

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");
    }
}

Last updated