Writing a Plugin class
The following Plugin class will allow BepInEx to load and handle your compiled assembly as a plugin
In Visual studio right click "Class1.cs" in the solution explorer and rename it to "Plugin.cs". Choose "Yes" to rename all references
Copy and paste the following code into "Plugin.cs" replacing the entire contents of the file
Save your changes by selecting File > Save Plugin.cs
You should now be ready to compile your first plugin
Explaining how this work
We create a new class that inherits from the BepInEx BasePlugin class. We give this new class a special attribute (the BepInPlugin
thing above the class) which BepInEx uses to make this class into a full-fledged plugin. The arguments we supply to the attribute include:
The GUID:
"NewbiePluginAuthor.MyFirstPlugin"
This is an identifier which should uniquely identify the plugin. Typically justauthor.pluginname
should suffice.The plugin name:
"MyFirstPlugin"
Last updated
Was this helpful?