Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 662 Bytes

File metadata and controls

31 lines (25 loc) · 662 Bytes
title BepInEx Guide
sidebar_position 0

Best Practices

Here is an example BasePlugin class. Note how it does not (ab)use static variables everywhere, and calls Harmony.PatchAll() after it has been created with an Id defined by the BepInAutoPlugin.

using BepInEx;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Reactor;
using Reactor.Utilities;

namespace Example;

[BepInAutoPlugin]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
public partial class ExamplePlugin : BasePlugin
{
    public Harmony Harmony { get; } = new(Id);

    public override void Load()
    {
        Harmony.PatchAll();
    }
}