Skip to Content

How to Install and Create Mods for Crystal Guardians with BepInEx and Harmony

How Do You Install and Create Mods for Crystal Guardians Using BepInEx? Master Modding for Crystal Guardians: Easy Steps with BepInEx & Harmony

Install BepInEx

Step 1: Install BepInEx

Without BepInEx, mods won’t load, making all efforts futile.

  1. Download a compatible version of BepInEx (5.4.x series). Versions 5.4.22 and 5.4.23.1 are tested and reliable.
  2. Choose the version matching your platform (Windows, Linux, or MacOS).
  3. Locate the game directory on Steam, right-click the game > Manage > Browse Local Files.
  4. Extract the BepInEx .zip file into the game directory.

Step 2: Enable BepInEx Console

BepInEx Console helps debug issues by showing logs in a console window.

  1. Navigate to BepInEx/config/BepInEx.cfg.
  2. Under [Logging.Console], change Enabled = false to Enabled = true and save.
  3. Disable Steam Overlay to avoid glitches during modding.

Step 3: Install Mods

Extract the mod files into the game directory (refer to the README file included with mods).

Where to find mods? Steam Discussions or GitHub searches are your best bets since there’s no centralized mod database yet.

Create Your Own Mod

Creating mods involves setting up tools for code and asset creation.

Step 4: Install Unity Engine

  1. Install Unity Hub to manage Unity Editor versions.
  2. Use Unity version 2021.2.14f1 (the same as the game engine).
  3. Follow Unity Hub prompts to install this version.

Step 5: Setup Unity Project

  1. Open Unity Hub > Projects tab > New Project.
  2. Select “Universal 3D” template (download if missing).
  3. Name your project and create it.
  4. Add the UnityGuardian package:
    1. Go to Window > Package Manager > Add package from git URL.
    2. Paste: https://github.com/Xaymar/UnityGuardian.git.

Step 6: Create BepInEx Plugin

  1. In your Unity project, create a folder named Mods under Assets.
  2. Open a shell in this folder (Shift+Right-Click > Open Powershell/Command Prompt).
  3. Run: dotnet new -i BepInEx.Templates –nuget-source https://nuget.bepinex.dev/v3/index.json
  4. Create a plugin template: dotnet new bepinex5plugin -n YOURNAME.MODNAME -T net46 -U 2021.2.14
  5. Replace YOURNAME.MODNAME with your name and mod name.

Step 7: Fix Template Issues

Modify the .csproj file:

<OutputPath>..\..\..\BepInEx\plugins\$(SolutionName)</OutputPath>
<BaseIntermediateOutputPath>..\..\..\obj</BaseIntermediateOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

Add a Directory.Build.props file with:

<Project>
<PropertyGroup>
<OutputPath>..\..\..\BepInEx\plugins\$(SolutionName)</OutputPath>
<BaseIntermediateOutputPath>..\..\..\obj</BaseIntermediateOutputPath>
</PropertyGroup>
</Project>

Step 8: Add Assets

  1. Drag and drop assets into Unity.
  2. Assign an Asset Bundle name (use your mod name).

Drag and drop assets into Unity. Assign an Asset Bundle name

Step 9: Load Assets in Code

Add this snippet to your plugin’s Plugin.cs file:

// Start of: AssetBundle loader.
string whoAmI = System.Reflection.Assembly.GetExecutingAssembly().Location;
string whereAmI = System.IO.Path.GetDirectoryName(whoAmI);
if (string.IsNullOrEmpty(whereAmI)) {
throw new System.IO.FileNotFoundException("Failed to find myself.");
}

// - Load all Asset Bundles in our directory.
foreach (var file in System.IO.Directory.EnumerateFiles(whereAmI, "*.assetbundle"))
{
Logger.LogInfo($"Loading bundle '{file}'...");
AssetBundle.LoadFromFile(file); // This is fine, Unity keeps track of them.
}
// End of: AssetBundle loader.

Load Assets in Code

Build and Test Mod

  1. In Unity Editor, go to Guardian > Bundler > Export.
  2. Build your .csproj file for Debug or Release mode.
  3. Copy the BepInEx folder from your project directory into the game directory.

Publish Mod

Currently, share mods manually via .zip files or GitHub repositories until a mod store is available.

This process might seem daunting at first, but each step builds towards creating something unique for Crystal Guardians. Take it slow, troubleshoot as needed, and enjoy crafting mods that bring your ideas to life!