How V Rising Mods Work: BepInEx, IL2CPP, and DOTS Explained
V Rising mods rely on a few technologies that work a bit differently from standard C# development. You don't need to understand all of them deeply to get started, but knowing the basics will save you a lot of confusion.
BepInEx: The Mod Loader
BepInEx is what loads your mod. When V Rising starts, BepInEx runs first, finds all DLLs in BepInEx/plugins/, and calls Load() on each one.
Your Load() method is called once at startup. This is where you register your commands and patches. The game world does not exist yet at this point. You cannot access players, entities, or game data here. That comes later.
public override void Load()
{
// Safe here: register patches, register commands, read config files.
// NOT safe here: query entities, access players, read game data.
_harmony.PatchAll(Assembly.GetExecutingAssembly());
CommandRegistry.RegisterAll();
}What happens and when:
- BepInEx loads your DLL and calls
Load() - Your Harmony patches and VCF commands are registered
- The game world finishes booting
- A one-shot patch fires and calls
Core.InitializeAfterLoaded(), which is when your services set up - Everything is ready; commands and patches work normally
The template includes the init patch for you. Just put world-dependent code in Core.InitializeAfterLoaded() and you're good.
IL2CPP: Why the Game Compiles Differently
V Rising is built with IL2CPP, which means the game's C# code was compiled all the way down to native machine code for performance. This is why you can't just open the game DLLs like a normal .NET app; the original C# is gone.
BepInEx works around this by generating a set of C# wrapper files that give you something to code against. These live in BepInEx/interop/ and are what you're actually referencing when you use game types in your mod.
For day-to-day modding, this mostly just works. But there are a few places it surfaces:
- Collections: Game APIs return
Il2CppSystemcollections, not standard C# ones. Don't try to mix them. If a method returns anIl2CppSystem.Collections.Generic.List<T>, use it as-is rather than converting toSystem.Collections.Generic.List<T>. - Lambdas passed to game code: If you're passing a callback into a game method, you may need
Il2CppSystem.Actioninstead of a plain C# lambda. This usually only comes up in advanced scenarios. - Casting errors look different: A failed type cast in IL2CPP throws a different exception than you might expect. If you see a cryptic exception on a cast, that's why.
Most beginners won't hit these issues until they're doing more advanced work. When something breaks in a confusing way, check whether it's an IL2CPP type mismatch.
DOTS/ECS: A Different Way to Think About Game Objects
V Rising uses Unity's ECS (Entity Component System), which is a very different model from traditional Unity development.
Server-side mods don't use GameObjects. All game logic lives in ECS. Client mods can still interact with Unity's GameObject layer for UI or visual changes, but if you're writing server logic, the model is:
| Traditional Unity | V Rising (ECS) |
|---|---|
GameObject with components attached | Entity (just an ID number) |
GetComponent<Health>() | entity.Read<Health>() |
GameObject.Find("Player") | Query for entities that have PlayerCharacter |
Logic in MonoBehaviour.Update() | Logic in SystemBase.OnUpdate() |
In practice, when you want to do something to a player or entity, you:
- Get the entity (usually passed in via a patch or a service query)
- Read the component you care about
- Modify it and write it back
// Read a component, change it, write it back:
var health = entity.Read<Health>();
health.Value = health.MaxHealth;
entity.Write(health);That's the core loop for almost all gameplay modifications. The rest is just knowing which components hold which data.
Server vs Client Mods
Your mod DLL runs on whatever machine installs it. V Rising separates into two processes:
- Server mods run on the server. They control game logic, entities, and world state. Players don't need the mod installed to benefit from it.
- Client mods run on each player's machine. They can change UI or visuals but can't change game rules.
Most V Rising mods are server-side. If yours is server-only, make sure it only runs server-side logic when on a server:
if (Application.productName == "VRisingServer")
{
// server-only setup
}A Note on Reflection
If you come from standard .NET and try to use reflection (typeof(Foo).GetMethod("Bar")) on game types, it may not work as expected. The wrapper DLLs generated by IL2CPP interop don't always preserve all metadata, and some method names or field names are slightly different from what you might expect.
TIP
You usually don't need reflection for standard modding. Harmony patches, ECS component reads, and VCF commands cover the vast majority of what mods do. If you find yourself needing reflection, check whether there's a simpler ECS or Harmony approach first.
