A basic library/patcher that allows you to use Rpcs in a static context. Network Variables are on the plate, but are not in the initial release.
Usage
Add the appropriate BepInDependency attribute to your plugin class, like so:
[BepInDependency(StaticNetcodeLib.Guid, DependencyFlags.HardDependency)]
public class ExampleMod : BaseUnityPlugin
Then add the StaticNetcode attribute to any classes that have static rpcs.
[StaticNetcode]
public class ExampleNetworkingClass
After that, you can simply use Server & Client Rpcs as you normally would (even outside NetworkBehaviours), but in a static context, like so:
[ClientRpc]
public static void ExampleClientRpc(string exampleString)
{
ExampleMod.Logger.LogDebug(exampleString);
}
/* ... */
ExampleClientRpc("Hello, world!");
Note: The Rpc attribute params are not respected for this. For example, ServerRpcs are static and thus cannot have an owner, and are used as if it had the RequireOwnership = false parameter.
Links
GitHub: https://github.com/Xilophor/StaticNetcodeLib
NuGet: https://www.nuget.org/packages/Xilophor.StaticNetcodeLib
Thunderstore: https://thunderstore.io/c/lethal-company/p/xilophor/StaticNetcodeLib/
Example Project:https://github.com/Xilophor/Disintegration
This lib is not specific to Lethal Company, and should not break between updates.





