This tool is still in development and is quite experimental, but should be usable.
This also does not support exporting a plugin from within the editor yet.
This tool fills in a unity project with functional assets so you can run the game in the editor to test custom plugins.
This tool does not distribute game files. It uses what is already on your computer from the installed game.
- Installs required packages, and enforces specific versions for them
- Updates various project settings:
- Tags
- Layers
- Physics settings
- Time settings
- Navmesh settings
- Strips generated netcode inside of game scripts so they can compile in Unity
- Fixes missing script references
- Fixes missing shaders on materials
- Fixes broken scriptable objects
- Copies needed DLLs from the game directly
- Exports game assets with an embeded version of Asset Ripper
- Sets up a BepInEx environment to test patches and plugins in-editor
- Can load up normal plugins in-editor
- Supports disabling domain reloading in-editor for faster compile times
- And much more!
- About 900 MB for the asset ripper export
- There is a toggle to delete the export after the patcher is done
- About 900 MB for the copied files from that export into the project
- Git
- Unity 2022.3.9f1
- .NET 8.0
- For running Asset Ripper
- Make sure you have git installed: https://git-scm.com/download/win
- After installing, restart Unity
- Open the Package Manager from
Window > Package Manager
- Click the '+' button in the top-left of the window
- Click 'Add package from git URL'
- Provide the URL of the this git repository: https://github.com/nomnomab/lc-project-patcher.git
- If you are using a specific version, you can append it to the end of the git URL, such as
#v0.3.0
- If you are using a specific version, you can append it to the end of the git URL, such as
- Click the 'add' button
- Create a new Unity project
- Use version 2022.3.9f1
- Use the 3D (HDRP) template
- Open the tool from
Tools > Nomnom > LC - Project Patcher > Open
- This will create some default folders for you when it opens
At this point if you have the DunGen asset, or any other asset store asset, import it now and move it into
Assets\Unity\AssetStore
. This is the location the patcher checks for existing assets if needed.
- Assign the Game's data directory path at the top
- Example being
C:\Program Files (x86)\Steam\steamapps\common\Lethal Company\Lethal Company_Data
- Example being
- Click the
Run Patcher
button- This process will take a while, so be patient
- The editor may restart a few times, this is normal
- When it asks about the New Input System and switching backends, click
Yes
- Now you should have a nice template to work from!
You can make plugins directly in the editor like normal.
I have not tested patchers, so use them with caution!
If you want to add some normal plugins, you'll have to navigate outside of Assets
for this, and next to it is a folder called Lethal Company
.
This is a dummy folder that houses the normal BepInEx root and a fake game data structure so it can initialize before I route it to the actual game files.
[ProjectName]\Assets\LethalCompany\Game
- The ripped game assets in an easier to navigate folder structure[ProjectName]\Assets\LethalCompany\Mods
- A common folder to place custom plugins or plugins you want to reference[ProjectName]\Assets\LethalCompany\Tools
- BepInEx, MonoMod, and any other "core" dll goes here[ProjectName]\Assets\Unity\AssetStore
- Where assets from the asset store should go to keep them nice and tidy- Also where the tool picks up DunGen from to use for guids instead of the one provided by the game
- This folder gets re-imported when the tool runs to fix any weird asset issues
[ProjectName]\Assets\Unity\Native
- The default files/folders that were in theAssets
root when running the tool[ProjectName]\Lethal Company\BepInEx
- The normal BepInEx directory people are used to[ProjectName]\*.cfg
- Where the editor version of BepInEx places config files
Yep! Just turn on the option located at Tools > Nomnom > LC - Project Patcher > Use Game BepInEx Directory
.
Afterward, you should restart Unity if you already have some plugins loaded up to unload them.
Yes, but you'll have to do it manually.
- Copy the code from https://github.com/nomnomab/lc-project-patcher/blob/v0.3.0/Editor/ExtractProjectInformationUtility.cs and paste it into a new script in the project with your existing assets called
ExtractProjectInformationUtility.cs
- Run the type extractor from
Tools > Nomnom > LC - Project Patcher > Extract Project Information
- Once this is done, it will make a json file with the required information at the location you specified
- Go back to the new project
- Copy over any assets from the old project to the new project
- Run the asset patcher from
Tools > Nomnom > LC - Project Patcher > Patch Assets From Other Projects...
- Select the json file you made from the other project
- Wait for the patcher to complete
- Now your prefabs/scenes should be migrated over properly
If there are any "missing prefab" issues in your prefabs/scenes, then make sure you have the needed assets in the project.
This does not migrate materials, audio clips, meshes, etc to the ones in the new project, so those will have to be manually fixed if needed.
If a plugin is loaded while playing the game in-editor, then it will stay loaded forever. This is just how Unity handles their dll hooks.
If you need to remove a plugin, then close unity first, then delete it.
The same steps go for anything else that BepInEx has a hook on, such as its log files.
For some reason the diagetic audio mixer's master group has effects on by default. The main reason why there is an echo
is due to the Echo
effect on it.
If the auto-patcher didn't work, you can remove this effect by:
- Opening the
Diagetic
audio mixer - Clicking on the
Master
group - Going into the inspector and navigate to where
Echo
is - Click the gear in the top-right of the effect and click
Bypass
- Profit
Make sure you understand what you have to do manually if domain reloading is disabled
This is straightforward, as long as your own plugin code supports it.
Not all plugins support this by the way, so expect errors with ones that don't handle static values properly.
- Open the
Edit > Project Settings
menu - Go to the
Editor
tab - Check
Enter Play Mode Options
- Check
Reload Scene
Now it will take like a second to press play instead of a minute 😀
I only check Assembly-CSharp.dll for in-editor plugins at the moment.
For now get it normally via the normal game and the patcher approach. Once you have the dll, put it into the plugins directory.
- The default location is
[ProjectName]\Lethal Company\BepInEx\plugins
-
Parrel Sync - https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync
- This lets you run multiple instances of the project at once to test LAN without building the game.
-
Editor Attributes - https://github.com/v0lt13/EditorAttributes.git
- This is a nice package that adds some useful attributes for the inspector
- Asset Ripper - https://github.com/AssetRipper/AssetRipper
- Modified source - https://github.com/nomnomab/AssetRipper
- Asset Bundles Browser - https://github.com/Unity-Technologies/AssetBundles-Browser
- UniTask - https://github.com/Cysharp/UniTask
- UYAML Parser - https://gist.github.com/Lachee/5f80fb5cb2be99dad9fc1ae5915d8263
- MonoMod - https://github.com/MonoMod/MonoMod
- GameViewSizeShortcut - https://gist.github.com/wappenull/668a492c80f7b7fda0f7c7f42b3ae0b0
- BepInEx - https://github.com/BepInEx/BepInEx