API Reference
Complete reference documentation for all MDB Framework APIs.
Core APIs
Mod System
- ModBase - Base class for all mods with lifecycle callbacks
- ModAttribute - Metadata attribute for declaring mods
- ModLogger - Logging system with color-coded console output
Patching System
- Patch Attributes - Declarative method hooking (Harmony-style) — recommended
[Patch]- Target a class for patching[PatchMethod]- Target a specific method by name and parameter count[Prefix]- Run before original method[Postfix]- Run after original method[Finalizer]- Run even if original throws
- HookManager - Advanced fallback for runtime hook management
IL2CPP Bridge
- Il2CppBridge - P/Invoke declarations for IL2CPP runtime access
- Class resolution
- Method invocation
- Field access
- Type system queries
- String marshaling
- Array helpers
- Unity-specific helpers
ImGui Integration
- ImGuiManager - Callback registration and window management
- ImGui - Dear ImGui API bindings
- Windows and layouts
- Widgets (buttons, inputs, sliders, etc.)
- Trees and lists
- Menus and popups
- Drawing primitives
- Styling and theming
API Categories
By Difficulty
🟢 Beginner-Friendly
- ModBase - Simple lifecycle and logging
- ModLogger - Easy logging
- ImGuiManager - Basic UI registration
🟡 Intermediate
- Patch Attributes - Declarative hooks (primary patching method)
- ImGui - UI construction
🔴 Advanced
- HookManager - Manual hooking (advanced fallback)
- Il2CppBridge - Direct IL2CPP access
Quick Reference
Mod Lifecycle
[Mod("Author.ModName", "Display Name", "1.0.0")]
public class MyMod : ModBase
{
public override void OnLoad() { } // Called once on load
public override void OnUpdate() { } // Every frame
public override void OnFixedUpdate() { } // Physics tick
public override void OnLateUpdate() { } // After all updates
public override void OnGUI() { } // ImGui rendering
}
Logging
Logger.Info("Info message");
Logger.Warning("Warning message");
Logger.Error("Error message");
Logger.Debug("Debug message");
Patching
[Patch("Namespace", "ClassName")]
[PatchMethod("MethodName", 2)] // 2 parameters
public static class MyPatch
{
[Prefix]
public static bool Prefix(IntPtr __instance, int damage, float multiplier)
{
// Named parameters map positionally to native args
// Return false to skip original
return true;
}
[Postfix]
public static void Postfix(ref int __result)
{
// Modify return value
}
}
ImGui UI
public override void OnLoad()
{
ImGuiManager.RegisterCallback(DrawUI, "My Window");
}
private void DrawUI()
{
if (ImGui.Begin("My Window"))
{
ImGui.Text("Hello!");
if (ImGui.Button("Click"))
Logger.Info("Clicked!");
}
ImGui.End();
}
IL2CPP Bridge
// Find a class
IntPtr klass = Il2CppBridge.mdb_find_class("Assembly-CSharp", "Game", "Player");
// Get a method
IntPtr method = Il2CppBridge.mdb_get_method(klass, "TakeDamage", 1);
// Get a field value
IntPtr field = Il2CppBridge.mdb_get_field(klass, "health");
float health = Il2CppBridge.mdb_field_get_value<float>(instance, field);
Navigation
- ModBase - Mod Lifecycle
- ModAttribute - Mod Metadata
- ModLogger - Logging System
- Patch Attributes - Declarative Hooks
- HookManager - Manual Hooks (Fallback)
- Il2CppBridge - IL2CPP Runtime Access
- ImGuiManager - UI Management
- ImGui - UI Construction
| ← Back to Home | Getting Started → |