Mod Loader/AssetBundles
An AssetBundle is a file built by Unity that holds assets such as audio clips or shaders. Your plugin loads those assets from the bundle. You'll build one in the Unity Editor and put it beside your plugin DLL.
Install Unity
The Public Beta and Previous Version installations checked for this guide both use Unity 6000.3.4f1. Check BepInEx/LogOutput.log for the Unity version when targeting a newer game build. Install that Editor version through Unity Hub and the Editor archive. Add the build-support module for the platform you want to distribute to.
Create an empty 3D project for audio. For shaders, start with the Universal 3D template. Keep the Unity project outside your Dressmaker installation.
Import your audio
- In the Project window, make an
Assets/ModAudiofolder. - Copy your music into it as
MainTheme.wavand your short purchase sound asBuy.wav. These are your own audio files. - Select each file. Use the Inspector preview to check that it plays. Start with the default import settings.
- Create
Assets/Editor. Save the following file there asBuildModBundles.cs.
using System.IO;
using UnityEditor;
public static class BuildModBundles
{
[MenuItem("Mod tools/Build Windows bundles")]
private static void Windows() => Build(BuildTarget.StandaloneWindows64);
[MenuItem("Mod tools/Build macOS bundles")]
private static void Mac() => Build(BuildTarget.StandaloneOSX);
private static void Build(BuildTarget target)
{
string folder = "ModBundles/" + target;
Directory.CreateDirectory(folder);
var bundles = new[] {
new AssetBundleBuild {
assetBundleName = "music",
assetNames = new[] { "Assets/ModAudio/MainTheme.wav" },
addressableNames = new[] { "MainTheme" }
},
new AssetBundleBuild {
assetBundleName = "sounds",
assetNames = new[] { "Assets/ModAudio/Buy.wav" },
addressableNames = new[] { "Buy" }
}
};
var result = BuildPipeline.BuildAssetBundles(folder, bundles,
BuildAssetBundleOptions.ChunkBasedCompression, target);
if (result == null) throw new System.Exception("Bundle build failed. Check the Unity Console.");
EditorUtility.RevealInFinder(folder);
}
}
If you only need one bundle, remove the other AssetBundleBuild entry. The assetNames path must match the file in your Unity project. addressableNames sets the exact name passed to LoadAsset in your plugin.
Build and install
- Wait for Unity to compile the script. Fix any red errors in Window > General > Console.
- Choose Mod tools > Build Windows bundles, or the macOS entry for a macOS download.
- Open the output folder. Copy the file called
musicorsounds, with no extension, into the matching plugin folder below.
BepInEx/plugins/
ExampleMusic/
ExampleMusic.dll
music
ShopAudio/
ShopAudio.dll
sounds
Build the DLL using the C# guide. Use the complete plugin from Soundtrack API or Purchase sound API. These examples load a single self-contained bundle; its accompanying .manifest text file is not needed in the plugin folder. Build separate bundles for Windows and macOS, and put the appropriate files in each download.
Bundle a shader
Shaders must work with Dressmaker's Universal Render Pipeline (URP). In your Unity project, open Window > Package Management > Package Manager and select Packages: In Project to check your Universal RP version. An exact matching URP package version for Dressmaker has not been confirmed; test a shader bundle in the game before distributing it.
Save your shader in the Unity project at Assets/Shaders/SheerFabric.shader. Replace the bundles array in the build script with:
var bundles = new[] {
new AssetBundleBuild {
assetBundleName = "fabric-shaders",
assetNames = new[] { "Assets/Shaders/SheerFabric.shader" },
addressableNames = new[] { "Assets/Shaders/SheerFabric.shader" }
}
};
For a Shader Graph asset, use its actual .shadergraph path in both entries. Build for the player's platform and copy fabric-shaders beside your plugin in BepInEx/plugins/ExampleSheerFabric. The Fabric API example loads it by the name above.
A shader also needs the correct render pipeline, graphics API, and shader variants. Keep a test material using the shader and its intended keywords in the bundle when those variants are needed. Check the shop bolt and an actual dress; garment views can use a different material from the bolt.
If it does not load
- Bundle missing: check the file's location and platform. Copy the extensionless bundle, not its manifest.
- Clip missing: compare the name in
LoadAssetwithaddressableNames. Capitalization matters. - Pink fabric: check the shader compilation errors, render pipeline, build target, and required variants. Rebuild after fixing them.
Unity documents the build options under BuildPipeline.BuildAssetBundles and the file/name mapping under AssetBundleBuild.