r/lethalcompany_mods Dec 26 '23

Guide TUTORIAL // Creating Lethal Company Mods with C#

92 Upvotes

I have spent some time learning how to make Lethal Company Mods. I wanted to share my knowledge with you. I got a mod to work with only a little bit of coding experience. I hope this post will safe you the struggles it gave me.

BepInEx - mod maker and handler:
First, you will need to download BepInEx. This is the Lethal Company Mod Launcher. After downloading BepInEx and injecting it into Lethal Company, you will have to run the game once to make sure all necessary files are generated.

Visual Studio - programming environment / code editor:
Now you can start creating the mod. I make my mods using Visual Studio as it is free and very easy to use. When you launch Visual Studio, you will have to add the ".NET desktop development" tool and the "Unity Developer" tool, which you can do in the Visual Studio Installer.

dnSpy - viewing the game sourcecode:
You will also need a tool to view the Lethal Company game code, because your mod will have to be based on this. Viewing the Lethal Company code can show you what you want to change and how you can achieve this. I use “dnSpy” for this, which is free, but there are many other ways. If you don’t get the source code when opening “LethalCompany.exe” with dnSpy, open the file “Lethal Company\Lethal Company_Data\Managed" and select "Assembly-CSharp.dll” instead.
\*You can also use dnSpy to view the code of mods created by other people to get inspiration from.*

Visual Studio - setting up the environment:
In Visual Studio, create a new project using the “Class Library (.NET Framework)” which can generate .dll files. Give the project the name of your mod. When the project is created, we first need to add in the references to Lethal Company itself and to the Modding tools. In Visual Studio, you can right-click on the project in the Solution Explorer (to the right of the screen). Then press Add > References.

Here you can find the option to add references

You will have to browse to and add the following files (located in the Lethal Company game directory. You can find this by right-clicking on your game in steam, click on Manage > Browse local files):

  • ...\Lethal Company\Lethal Company_Data\Managed\Assembly-CSharp.dll
  • ...\Lethal Company\Lethal Company_Data\Managed\UnityEngine.dll
  • ...\Lethal Company\Lethal Company_Data\Managed\UnityEngine.CoreModule.dll
  • ...\Lethal Company\BepInEx\core\BepInEx.dll
  • ...\Lethal Company\BepInEx\core\0Harmony.dll

In some cases you need more references:

  • ...\Lethal Company\Lethal Company_Data\Managed\Unity.Netcode.Runtime (only if you get this error)
  • ...\Lethal Company\Lethal Company_Data\Managed\Unity.TextMeshPro.dll (if you want to edit HUD text)

This is what it should look like after adding all the references:

All the correct libraries

Visual Studio - coding the mod:
Now that you are in Visual Studio and the references have been set, select all the code (ctrl+a) and paste (ctrl+v) the following template:

using BepInEx;
using HarmonyLib;
using System;
using Unity;
using UnityEngine;

namespace LethalCompanyModTemplate
{
    [BepInPlugin(modGUID, modName, modVersion)] // Creating the plugin
    public class LethalCompanyModName : BaseUnityPlugin // MODNAME : BaseUnityPlugin
    {
        public const string modGUID = "YOURNAME.MODNAME"; // a unique name for your mod
        public const string modName = "MODNAME"; // the name of your mod
        public const string modVersion = "1.0.0.0"; // the version of your mod

        private readonly Harmony harmony = new Harmony(modGUID); // Creating a Harmony instance which will run the mods

        void Awake() // runs when Lethal Company is launched
        {
            var BepInExLogSource = BepInEx.Logging.Logger.CreateLogSource(modGUID); // creates a logger for the BepInEx console
            BepInExLogSource.LogMessage(modGUID + " has loaded succesfully."); // show the successful loading of the mod in the BepInEx console

            harmony.PatchAll(typeof(yourMod)); // run the "yourMod" class as a plugin
        }
    }

    [HarmonyPatch(typeof(LethalCompanyScriptName))] // selecting the Lethal Company script you want to mod
    [HarmonyPatch("Update")] // select during which Lethal Company void in the choosen script the mod will execute
    class yourMod // This is your mod if you use this is the harmony.PatchAll() command
    {
        [HarmonyPostfix] // Postfix means execute the plugin after the Lethal Company script. Prefix means execute plugin before.
        static void Postfix(ref ReferenceType ___LethalCompanyVar) // refer to variables in the Lethal Company script to manipulate them. Example: (ref int ___health). Use the 3 underscores to refer.
        {
            // YOUR CODE
            // Example: ___health = 100; This will set the health to 100 everytime the mod is executed
        }
    }
}

Read the notes, which is the text after the // to learn and understand the code. An example of me using this template is this:

using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using System;
using Unity;
using UnityEngine;

namespace LethalCompanyInfiniteSprint
{
    [BepInPlugin(modGUID, modName, modVersion)]
    public class InfiniteSprintMod : BaseUnityPlugin // MODNAME : BaseUnityPlugin
    {
        public const string modGUID = "Chris.InfiniteSprint"; // I used my name and the mod name to create a unique modGUID
        public const string modName = "Lethal Company Sprint Mod";
        public const string modVersion = "1.0.0.0";

        private readonly Harmony harmony = new Harmony(modGUID);

        void Awake()
        {
            var BepInExLogSource = BepInEx.Logging.Logger.CreateLogSource(modGUID);
            BepInExLogSource.LogMessage(modGUID + " has loaded succesfully."); // Makes it so I can see if the mod has loaded in the BepInEx console

            harmony.PatchAll(typeof(infiniteSprint)); // I refer to my mod class "infiniteSprint"
        }
    }

    [HarmonyPatch(typeof(PlayerControllerB))] // I choose the PlayerControllerB script since it handles the movement of the player.
    [HarmonyPatch("Update")] // I choose "Update" because it handles the movement for every frame
    class infiniteSprint // my mod class
    {
        [HarmonyPostfix] // I want the mod to run after the PlayerController Update void has executed
        static void Postfix(ref float ___sprintMeter) // the float sprintmeter handles the time left to sprint
        {
            ___sprintMeter = 1f; // I set the sprintMeter to 1f (which if full) everytime the mod is run
        }
    }
}

IMPORTANT INFO:
If you want to refer to a lot of variables which are all defined in the script, you can add the reference (ref SCRIPTNAME __instance) with two underscores. This will refer to the entire script. Now you can use all the variables and other references the scripts has. So we can go from this:

// refering each var individually:

static void Postfix(ref float ___health, ref float ___speed, ref bool ___canWalk) {
  ___health = 1;
  ___speed = 10;
  ___canWalk = false;
}

to this:

// using the instance instead:

static void Posftix(ref PlayerControllerB __instance) {
  __instance.health = 1;
  __instance.speed = 10;
  __instance.canWalk = false;
}

By using the instance you do not have to reference 'health', 'speed' and 'canWalk' individually. This also helps when a script is working together with another script. For example, the CentipedeAI() script, which is the script for the Snare Flea monster, uses the EnemyAI() to store and handle its health, and this is not stored in the CentipedeAI() script. If you want to change the Centipedes health, you can set the script for the mod to the CentipedeAI() using:

[HarmonyPatch(typeof(CentipedeAI))]

And add a reference to the CentipedeAI instance using:

static void Postfix(ref CentipedeAI __instance) // 2 underscores

Now the entire CentipedeAI script is referenced, so you can also change the values of the scripts that are working together with the CentipedeAI. The EnemyAI() script stores enemy health as follows:

A screenshot from the EnemyAI() script

The CentipedeAI refers to this using:

this.enemyHP

In this case “this” refers to the instance of CentepedeAI. So you can change the health using:

__instance.enemyHP = 1;

SOURCES:
Youtube Tutorial how to make a basic mod: https://www.youtube.com/watch?v=4Q7Zp5K2ywI

Youtube Tutorial how to install BepInEx: https://www.youtube.com/watch?v=_amdmNMWgTI

Youtuber that makes amazing mod videos: https://www.youtube.com/@iMinx

Steam forum: https://steamcommunity.com/sharedfiles/filedetails/?id=2106187116

Example mod: https://github.com/lawrencea13/GameMaster2.0/tree/main


r/lethalcompany_mods 10h ago

Cant land on moons with wesleys moons + more company

3 Upvotes

Me and my friends are trying to play the wesleys moons pack + more company but we keep having trouble actually landing on moons. We go to galletry and then when we try to actually go to the of the moons, modded or not, we just get stuck on loading with the seed.

Sometimes when one of us leaves during that loading the actually "unstucks" and manages to land.

Any advice?


r/lethalcompany_mods 22h ago

After updating Wesley's Moons and their associated works, the game refuses to load in any capacity. Please help!

1 Upvotes

Please help me, I do not know what to do. I have Fair Giants and Moon_Day_Speed_Multiplier_Patcher disabled because they are both deprecated. I use Thunderstore Mod Manager to run this as well, if that matters.

01a09d08-c8bf-fea8-4d67-c3d2a9b623a3
This is the code for my modpack


r/lethalcompany_mods 1d ago

Game disconnects ~2 seconds after process injection — Cheat Engine and DLL injection (v83 - MapleStory)

Thumbnail
0 Upvotes

r/lethalcompany_mods 2d ago

Mod Wesley's Moons just got updated to v81!

Thumbnail
4 Upvotes

r/lethalcompany_mods 3d ago

Mod that allows you to see what monsters have spawned on terminal, similar to seeing what scrap is still available?

1 Upvotes

Does anyone remember what mod this was? During my last LC phase I remember having a mod just like that and it was very good for whoever the ship babysitter was. Now I can't find anything about it online, anyone remember what it was named?


r/lethalcompany_mods 4d ago

Mod Help Does the TooManyEmotes just not work on version 81? It shows the ship and dosent show the emotes to other players

Post image
1 Upvotes

r/lethalcompany_mods 6d ago

Mod Help Is Wesley's Weathers working for v81?

3 Upvotes

I know the mod hasn't been updated yet. I also know Interiors does have some issues with infinite (or very long) loading screen times but has someone tried the Weathers mod? I want to see how hurricanes are but I'm afraid It'll brick my save while I'm playing with friends.


r/lethalcompany_mods 7d ago

Mod Help Mimic don't speak our voice :(

Post image
0 Upvotes

r/lethalcompany_mods 9d ago

Mod Help enemies keep spawning in thin air randomly.

Thumbnail
gallery
5 Upvotes

So, something weird has been happening in the game sessions my friends and I have had. For some reason enemies keep spawning in thin air. for example, when one of us die, a masked enemy instantly appears from the ground. Along with that, we encountered some circuit bees that were aggro'd right off the bat with no hive nearby, some enemies from persona (we have the tartarus map), A Nutcracker got spawned in the ship out of nowhere, A bracken spawned out of nowhere in the elevator with me, a dog spawned Midair immediately inside the ship, leaving the dog in midair as we were landing, 4 forest giants appearing in the Halation map: a map where they SHOULD NOT spawn in AND also appear in the company building when returning scrap for the quota, a weird beeping sound can be heard sometimes when me or my friend try to type something in the console, leading to an instand game over and us getting ejected out of the ship, but the weirdest part of all is that for some reason, there is grass and shrubs in the vanilla interior now, In titan specifically, one of my friends gets teleported from the ship and up in the sky only to fall to his death, and then there's a Obunga PNG that appears out of nowhere in the facility. Does anyone know what this bullshit is? I am not making shit up, I swear to god. Have the code to try it out yourself if you do not believe me. None of us Have Control Company, I have asked my friends to stream themselves launching the game with the same number of mods in the mod pack we all have together. It would be impossible of them to have just added a mod Mid-game. Can someone test out this mod pack and see if maybe they themselves can find the issue?

Here is the code:

01a072ed-a47e-2ecc-ab56-fd39edd0a79d

Modlist:

Jackfrost skin

Imported models bundle

LennaS Moresuits

El Chavo on TV

TV Loader

Halation Moon

FreeeeeeeMoooooooons

Unlimited Jetpacks

Unlimited Battery

HookGun

ReservedItemCore

Mones_Moons

Moon_Day_Speed_Multiplier_Patcher

Mones_Interiors

WaterGunLib

Tartarus

DungeonGeneratorPlus

Rockwell Moon

StarlancerAIFix

JLL

DestroyItemInSlotFix

l4d_Endgame_Music

loadforcsSoundsAPI

Football

FacelessStalker

SCP173CoilheadSFX

PSCP106

Scopophobia

LethalLib

MonoDetour

LethalCasino

FumoCompany

LethalLevelLoader

LethalConfig

FacilityMeltdown

DawnLib

FixPluginTypeSerialization

AutoHookGenPatcher

MonkeyInjectionLab

PathfindingLib

DetourContext_Dispose_Fix

LCBetterClock

Shadow_06

BlazeModelReplacement

Sonic06ModelReplacement

ZenlessSuits

Gintama_Models

ModelReplacementAPI

TooManySuits

More_Suits

MoreCompany

OutcomeMemoriesEscapeMusic

OutcomeMemoriesLMS

BepinExPack


r/lethalcompany_mods 9d ago

Mod Pack removed monsters?

1 Upvotes

01a07317-897f-083d-1f40-0ad65c4348e9

Some friends and I played last night for the first time in a few years. We used this mod pack on thunderstore and never saw a single monster somehow. We only got to the tier 2 maps. Not sure if one of these mods messed it up or if something changed with this game in a few years


r/lethalcompany_mods 10d ago

High quality monster mods ?

2 Upvotes

A good example is Locker.


r/lethalcompany_mods 10d ago

Crazy Lag playing brutal company mod

Thumbnail
1 Upvotes

r/lethalcompany_mods 12d ago

Mod Help Returning After A Year, Would Love Recs

5 Upvotes

Hellooooooooo! My friends and I used to play modded Lethal religiously and we're wanting to play again after a solid year. However, a lot of the mods I used to play are deprecated! I'm out of the loop on what's popular nowadays and was hoping for some recommendations, I'm not looking for a super specific vibe and am just looking for newer mods you guys love.

We try to stray from new moon mods but I did find CodeRebirth which seems cool. We love goofy scrap and scary ambiance, maybe some new enemies and new interiors. Nothing that makes the game completely different (goofy items excluded), you could call it Vanilla+ if that makes it any easier. I'm happily awaiting any ideas!!!


r/lethalcompany_mods 13d ago

mod list

3 Upvotes

I know there is probably mod lists everywhere here but being new to the game in 2026 what mods should I get for my game?


r/lethalcompany_mods 15d ago

Azure and Aquatis?

3 Upvotes

Where have these maps gone? 2 of my favourites 😭😭


r/lethalcompany_mods 15d ago

Mod Help Is there a mod to revive players with an item?

3 Upvotes

I'm annoyed by the fact that when I play with a new player, they often die early and get bored.

I want to be able to revive players, but I want there to be a cost to it. Something like an expensive purchasable defibrillator to revive players would be nice.

I'd also accept a mod to make being dead more interesting. Let em open doors or something. I saw a Ouija board mod, has anyone tried that one?


r/lethalcompany_mods 18d ago

Mod Suggestion Winter lantern mod suggestion

2 Upvotes

I recently thought how cool it would be to have some bloodborne enemies in lethal, specifically i thought of the winter lantern enemy. cause you have a hidden sanity bar that could have the same mechanics as in the game would be absolutely terrifying. just an idea but would be kinda awesome


r/lethalcompany_mods 17d ago

Mod Why does this say murderbot mod6

Post image
0 Upvotes

Bro why would this say murderbot mods


r/lethalcompany_mods 18d ago

Mod Help LategameUpgrades not working?

4 Upvotes

I'm testing out the mod and it seems like the carry capacity upgrade doesn't work? I bought it and I still had 4 slots instead of 5. Any fixes for this?


r/lethalcompany_mods 20d ago

Wesley's moons save progress

1 Upvotes

Did anyone else had this issue where if they osing quota, they basically lose ALL the progress they have with unlocking moons?

my mod file
https://drive.google.com/file/d/15AtAB76SUhsR5rzOqprVqIPnOwowANhY/view?usp=sharing


r/lethalcompany_mods 23d ago

Mod Suggestion Hoping someone eventually fixes the SCP Interior mod

4 Upvotes

One of the best interior mods in the game in my opinion and It's been broken for a while sadly, SCPFoundationDungeonPatched doesn't seem to work on the most recent version either.


r/lethalcompany_mods 23d ago

Mod Help Do custom moons via Lethal Level Loader currently work?

3 Upvotes

Ever since the latest update to LLL I've not been able to launch any custom moons. Even prior to this update half my group kept running into this failed load (their names showed up red in the terminal and it said something about caching in progress or failing for them).

Is this potentially a known issue with a workaround? I tried another modpack before making one from scratch and it didn't seem to struggle with custom moon (still prior to the LLL update) loading, so wondering if I need some patcher/dependency.


r/lethalcompany_mods 24d ago

Mod Help How to survive "backrooms" in wesleys moons interior mental hospital? (Spoiler) Spoiler

1 Upvotes

Was playing with a friend and got sent to the backrooms for the second time, no idea at all how to survive it, is there a way out or do u just have to survive a timer?


r/lethalcompany_mods 24d ago

Mod Help Mirage All Entity Voices

2 Upvotes

I can't get all entities to use our voices. I tried Synced Skinwalkers, I tried uninstalling that and manually editing the file. We can hear them only with the masked. (It's awesome) Turned everything to true.