|
1 | 1 |
|
| 2 | + |
2 | 3 | # Unity Netcode Patcher |
3 | 4 | **This is an assembly patcher which replicates the IL Post Processing that unity does with it's Netcode For Gameobjects Package, allowing you to create custom NetworkBehaviours in mods as if you were doing it in a Unity project.** |
4 | 5 |
|
|
13 | 14 | 1. Download the latest release from [Releases](https://github.com/EvaisaDev/UnityNetcodeWeaver/releases) |
14 | 15 | 2. Move NetcodePatcher folder from the zip into any location, I will have it in `O:/NetcodePatcher` for this tutorial. |
15 | 16 | 3. Move contents of `GameFolder/GameName_Data/Managed` into `NetcodePatcher/deps` |
16 | | -4. Add the following snippet to your mod, in a place where it will only run once, such as `Awake()` |
17 | | - - **It is very important that it only runs once!** |
| 17 | + |
| 18 | +## Preparing mods for patching |
| 19 | +To ensure that the patched NetworkBehaviours are initialized properly, add the following code snippet to your mod, in a place where it will only run once, such as `Awake()` |
| 20 | +- **It is very important that it only runs once!** |
18 | 21 | ```cs |
19 | 22 | var types = Assembly.GetExecutingAssembly().GetTypes(); |
20 | 23 | foreach (var type in types) |
|
29 | 32 | } |
30 | 33 | } |
31 | 34 | } |
32 | | - ``` |
| 35 | + ``` |
33 | 36 |
|
34 | 37 | ## Usage from command line |
35 | 38 |
|
|
44 | 47 |
|
45 | 48 | Example post build event: |
46 | 49 | ``` |
47 | | -xcopy "$(TargetPath)" "O:\NetcodePatcher\plugins\LethalThings" /Y |
48 | | -xcopy "$(TargetDir)$(AssemblyName).pdb" "O:\NetcodePatcher\plugins\LethalThings" /Y |
49 | 50 | cd O:\NetcodePatcher |
50 | | -NetcodePatcher.dll plugins/ deps/ |
51 | | -xcopy "O:\NetcodePatcher\plugins\LethalThings\$(AssemblyName).dll" "C:\Program Files (x86)\Steam\steamapps\common\Lethal Company\BepInEx\plugins\LethalThings" /Y |
| 51 | +NetcodePatcher.dll $(TargetDir) deps/ |
52 | 52 | ``` |
53 | 53 | Essentially what it is doing is copying the assembly and the pdb file from the output folder, and running the patcher. |
54 | 54 | Then copying the patched assembly to the plugins folder. |
|
0 commit comments