Lethal Croc


After spending a lot of time working on projects in Unity engine, I wanted to learn how to develop a mod for an existing Unity game. I chose to work with a friend to change the main scavenger character of Lethal Company into a croc!

Utilizing the Lethal Company modding community and their recommended APIs, I was able to learn the modding process and achieve this in just under a week. It’s now available for download on Thunderstore.

Captured video by a user of the mod on X/Twitter

ADDING REFERENCES

The first part of the process was figuring out how to setup a project that connects with the existing game files. I setup a C# Class Library application in Visual Studio with .NET Standard 2.1. Afterwards, I had to research which libraries were needed and how to add them to Visual Studio to begin working on the logic for the mod itself. The libraries I used are included are on the left, which includes BepInEx, an API used to patch existing Unity games and a community made model replacement API to make the process of replacing the player character with the new model and rig much easier.


Logging a String

The next part of the setup was to utilize BepinEx and Harmony to inject my code into the existing game files. I learned the basics of the API to see if I could simply log a string to the console when the game starts. After compiling the code on the right and placing it within the BepinEx folders, I was able to see that the plugin loaded quickly and I could continue my work!


Loading THE AssetBundle

The model replacement API allows the mesh and rig that my friend created to be remapped to the skeleton of the main scavenger character for Lethal Company and compiles it into an AssetBundle. I learned that in order to see the character in the game, the asset bundle needed to be pulled out of the compiled assembly and loaded on startup.


Character Setup

Finally, the prefab containing the character needed to be loaded out of the asset bundle and configured before it was ready to play. That could be done in a single line but we decided to take it a step further and add physics to the tail bone of the body so that it could flop around at runtime. To do this, we utilized the EZSoftbone package on the asset store that allowed for bone physics. The component we needed from the package could not be attached to the prefab before it was compiled into the AssetBundle, so I found a workaround by adding it at runtime and setting up all the needed configurations before the player character was replaced!


I was super excited to get this working, as it was the first mod I’ve ever made. I had no prior experience with plugins, asset bundles, or utilizing tools that inject code into an existing game until working through this week-long project. I utilized the knowledge I got from setting up this project for the Poisson Sampling Tool that I developed later on.

Lethal Croc in the Unity editor