Mod Loader/CSharp APIs
Use a C# plugin to add a keyboard shortcut, change accessory placement, or react when a player changes a setting. To add fabrics, garments, accessories, or dialogue, you can start with a content pack.
For methods, overloads, and hooks grouped by task, use the API index.
What you need
- Dressmaker with Mod Loader installed. Find the game folder containing
Dressmaker.exe. - The .NET SDK and the .NET Framework 4.7.2 targeting pack. Visual Studio with .NET desktop development is another way to get the build tools.
- A text editor, such as VS Code or Visual Studio.
A plugin is a DLL loaded by BepInEx when Dressmaker starts. The example below uses the DLLs already installed with your game, so you don't need to download copies of Unity or the loader assemblies. If you have more than one game installation, pick one game folder for the first build.
Make a plugin
Create a folder called HelloDressmaker. Put these two files in it.
Plugin.cs
using BepInEx;
[BepInPlugin("example.dressmaker.hello", "Hello Dressmaker", "1.0.0")]
[BepInDependency("yuu.dressmaker.mods")]
public sealed class HelloDressmaker : BaseUnityPlugin
{
private void Awake()
{
Logger.LogInfo("Hello Dressmaker loaded.");
}
}
Change example.dressmaker.hello to your own unique plugin ID when you make a real mod. The dependency tells BepInEx to load Mod Loader first. Awake runs when BepInEx loads your plugin; the log message gives you an easy first check.
HelloDressmaker.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="BepInEx">
<HintPath>$(DressmakerGameRoot)\BepInEx\core\BepInEx.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(DressmakerGameRoot)\Dressmaker_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(DressmakerGameRoot)\Dressmaker_Data\Managed\UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="DressmakerMods">
<HintPath>$(DressmakerGameRoot)\BepInEx\plugins\DressmakerMods.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<Target Name="CheckGameFolder" BeforeTargets="ResolveReferences">
<Error Condition="!Exists('$(DressmakerGameRoot)\Dressmaker.exe')"
Text="Set DressmakerGameRoot to the folder containing Dressmaker.exe." />
</Target>
</Project>
These references let the compiler find BepInEx, Unity, and Mod Loader. Private=false keeps copies of the game's DLLs out of your build output. Add other game assemblies only when your code uses them.
Compile it
Open PowerShell in the HelloDressmaker folder and run:
dotnet build .\HelloDressmaker.csproj -c Release -p:DressmakerGameRoot='C:\path\to\Dressmaker'
Replace the sample path with the folder that contains Dressmaker.exe. Keep the quotes if your path has spaces. The compiled file is bin\Release\net472\HelloDressmaker.dll. If the build says it cannot find .NET Framework 4.7.2 reference assemblies, install its Developer Pack or targeting pack. If a reference is missing, check that the path points to a Mod Loader installation and that the named DLL exists there.
Try it in the game
- Create
BepInEx\plugins\HelloDressmakerin your game folder. - Copy
HelloDressmaker.dllinto that folder. The build's copies of game or BepInEx assemblies do not belong in your plugin folder. - Start Dressmaker, then open
BepInEx\LogOutput.logand look forHello Dressmaker loaded.
If the message is missing, check the same log for a load error. Make sure you copied the new DLL into the game's actual plugin folder and that Mod Loader is installed. After changing your code, build again, replace your DLL, and restart the game.
Add something useful
Pick an API below and copy its smallest example into your plugin. Add using DressmakerMods; when the example uses a Mod Loader type. Use the dependency version and assembly references given with the example. For audio or shaders, follow Build an AssetBundle before trying to load one. For instance, the settings page shows how to add a toggle to Mod Settings.
The API examples show where to put each call. For example, settings can be registered in Awake, but music changes wait for the music controller. When an example stores a registration and disposes it in OnDestroy, keep both parts: disposing removes the command, setting tab, or other addition when the plugin unloads.
For more about BepInEx plugins themselves, see the BepInEx plugin tutorial.
For custom fabric shaders across game views, see Add a custom fabric shader and the Fabric render API.
Choose what you need
| To... | Open |
|---|---|
| Start a plugin, wait for content, handle events, and release resources | Plugin lifecycle |
| Track textures in custom previews or request original pixels | Texture use API |
| Register your plugin, stream textures, keep save data and share input | Plugin compatibility APIs |
| Load accessory models when needed and receive loading callbacks | AccessoryPrefabApi |
| Replace room art, sprites, and menu pictures | ArtModApi |
| Add a tab with toggles, sliders, or actions in Mod Settings | ModSettingsApi |
| Register fabrics or load a shader AssetBundle | FabricModApi |
| Replace room art, character portraits, sprite sheets or material colours | ArtModApi and MannequinColorApi |
| React to garment selection, panel creation or fabric changes | GarmentEventsApi |
| Add garment pieces and tags with icons or sketches | GarmentModApi |
| Add or hide rotating music tracks | SoundtrackModApi |
| Change shop purchase sounds | PurchaseSoundModApi |
| Change sketchbook pencil colors or select a drawing color | PencilColorModApi |
| Add an in-game debug command | DebugConsoleApi |
| Add remappable keys for your mod | ModKeybindApi |
| Measure or snap accessories and trim points while placing | AccessoryPlacementApi |
Friendship rewards
Give garment patterns when a native or modded client reaches a friendship level. See register a reward in C#.