# Writing a Plugin class

In Visual studio right click "Class1.cs" in the solution explorer and rename it to "Plugin.cs". Choose "Yes" to rename all references

{% hint style="info" %}
If you do not have a Class1.cs you can create Plugin.cs instead by choosing Project > Add Class...
{% endhint %}

Copy and paste the following code into "Plugin.cs" replacing the entire contents of the file

{% hint style="info" %}
If you do not see where to paste the code into, double click the Plugin.cs file in the solution explorer
{% endhint %}

```csharp
using BepInEx;
using BepInEx.Unity.IL2CPP;

namespace MyFirstPlugin;

[BepInPlugin("NewbiePluginAuthor.MyFirstPlugin", "MyFirstPlugin", "1.0.0")]
public class Plugin : BasePlugin
{
    public override void Load()
    {
        // Plugin startup logic
        Log.LogInfo("MyFirstPlugin is loaded!");
    }
}
```

Save your changes by selecting File > Save Plugin.cs

{% hint style="success" %}
You should now be ready to compile your first plugin
{% endhint %}

#### 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 just `author.pluginname` should suffice.
* The plugin name: `"MyFirstPlugin"`
* The plugin version: `"1.0.0"`\
  This uses [semantic versioning](https://semver.org/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gtfo-modding.gitbook.io/wiki/guides/your-first-plugin/writing-a-entrypoint-class.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
