B. Unity Setup

Updated 2 months ago

This page focuses on setting up CodeRebirthLib and CodeRebirthLib.Editor.

Folder Setup

  • This wiki assumes that you've managed to use https://github.com/nomnomab/unity-lc-project-patcher to patch a 2022.3.9f1 Unity Project with Lethal Company.
  • From there go to Assets/LethalCompany/Mods/plugins/MyModName (you're supposed to create the folder called MyModName but obv with your mod's name).
  • From there create a dependencies folder and drag in all the required dependencies to load in CodeRebirthLib.
  • For CodeRebirthLib's dependencies, all you need is to manually download CodeRebirthLib, LethalLib and PathfindingLib, open their zips and extract their contents onto your dependencies folder, try to stay a bit organised with it and it should look something like this:

UnityProject folder setup

[!NOTE]
Once the dependencies are imported, you need to find the CodeRebirthLib.dll and turn off validate references. If you're also adding in weathers, then you need to add WeatherRegistry and MrovLib to the dependencies folder and turn off validate references for WeatherRegistry (maybe MrovLib too).

CodeRebirthLib.Editor

  • To gain access to CodeRebirthLib's Editor tools, which allow no-code mods to build their packages in the editor and allow you to cleanly create configs, you need to go to CodeRebirthLib's github and download the .Editor dll from the latest release.
  • https://github.com/TeamXiaolan/CodeRebirthLib to the right is the releases tab, it should look something like this:

CodeRebirthLib Github Releases

[!NOTE]
You need to create an Editor folder inside the Assets folder of the UnityProject and put the dll there and NOT in the dependencies folder, otherwise unity will not register it as an editor tool.

Asset Bundles

  • For CodeRebirthLib, a lot of the convenience is on being able to separate content via multiple AssetBundles easily.
  • This means that to be able to tell what needs to be loaded or checked to be loaded, you need a main bundle that contains important information.
  • If you're creating a no-code mod, your main bundle that you create needs to have the extension .crmod
  • Something similar to the screenshot below in terms of creating but obv the name should be different according to what you want to name it.

Example Main Asset Bundle

[!NOTE]
If it's a mod that uses the C# Template then you can simply not worry about the extension and just leave it blank.

Mod Information

  • Mod Information is only needed if you're creating a no-code mod.
  • First thing you'd want to create is the Mod Information Scriptable Object.
  • From there filling it in is self-explanatory, you should put this Scriptable Object into your *.crmod AssetBundle.

Content Container

  • Generally the first thing you'd do when setting up CodeRebirthLib is create your ContentContainer Scriptable Object.
  • You can do that by right clicking on your Project at the bottom, Create -> CodeRebirthLib -> Content Container, similar to the screenshot below:

Content Container Create

  • Don't forget to put this Scriptable Object into your *.crmod bundle, or just your main bundle in general if you're not doing a no-code mod.
  • The Content Container contains one empty list of different content types separated by AssetBundles that you have to fill in for each AssetBundle you have (except your main bundle), each entry into the list is called an AssetBundleData.
  • An AssetBundleData contains 6 different Content Types that you are able to fill in, namely Enemies, Items, Ship Upgrades/Furniture, Inside/Outside Map Objects and finally Weathers.
  • This means that in one bundle you can have as many enemies, items, etc as you want to match connected content, i.e. 2 enemies that would interact with eachother would be in the same bundle or an enemy that drops a specific item would together be in that bundle.

AssetBundleData Preview

  • I won't be explaining each field but the main ones are Asset Bundle Name, Always Keep Loaded and Config Name, the rest are self-explanatory and are for configs for each different Content Type.
  • Asset Bundle Name is where you'd put the name of the AssetBundle that contains everything you have, whether its multiple enemies, items, etc, doesn't matter.
  • Always Keep Loaded is only if your bundle contains a VideoClip file, this is so that the VideoClip doesn't get deleted into oblivion, this is just a unity thing, this option does NOT mean that the bundle is always loaded regardless of config, but it is beneficial to some sense to have it disabled unless need be.
  • Config Name is the name of the category of the config, i.e. if you have multiple enemies into an AssetBundleData like Redwood Giant and Driftwood Giant, you could call the config Giant Variants.

Next Step?

  • From here, after reading this, your next step is making the content, follow the other pages of this wiki on how to make the specified content.