Creating Your First Plugin
Create your first BepInEx plugin and learn how a PvZ Fusion mod is structured.
What you'll build
By the end of this lesson, you will:
- Create a BepInEx plugin project
- Understand the basic plugin structure
- Compile a DLL
- Load your first mod in PvZ Fusion
Before you start
You should already have:
- PvZ Fusion installed
- BepInEx installed
- CustomizeLib installed
- Visual Studio 2022 installed
What is a plugin?
A plugin is a DLL loaded by BepInEx when the game starts.
Plugins allow developers to modify the game, add new content, and create entirely new mechanics.
Do not modify game files directly
Mods should be loaded through BepInEx plugins.
Avoid modifying game files directly whenever possible.
Creating the project
-
Open Visual Studio 2022.
-
Create a new project.
-
Select:
Class Library
-
Choose a project name.
-
Create the project.
Adding references
Your project needs references to BepInEx and the game's assemblies.
These references allow your code to interact with PvZ Fusion.
Creating your first plugin
Create a class that inherits from BaseUnityPlugin.
This class will be loaded automatically by BepInEx when the game starts.
Basic plugin structure
The following code shows the smallest possible BepInEx plugin.
Plugin examplecsharp[BepInPlugin("com.yourname.firstmod", "My First Mod", "1.0.0")]
public class MyFirstMod : BaseUnityPlugin
{
}
Building the plugin
Build the project using Visual Studio.
The generated DLL will be located inside the build output folder.
Installing the plugin
-
Locate the generated DLL.
-
Open:
BepInEx/plugins
- Copy the DLL into the plugins folder.
Testing the plugin
Launch PvZ Fusion.
If everything was configured correctly, BepInEx will load your plugin automatically.
First plugin completed
Congratulations!
You have created and installed your first BepInEx plugin.
You are now ready to start writing code and creating real PvZ Fusion mods.







