Creating an addon - SkEditorTeam/SkEditor GitHub Wiki
[!NOTE] This guide is written for Visual Studio, but you can use any IDE that supports .NET development like Rider or Visual Studio Code.
Creating a project
- To begin, you need to have Visual Studio ready for .NET development.
- Click on the "Create new project" button and select "Class library" for .NET.
- Give your project a name and click "Next".
- In the next window, make sure to select .NET 8.0
- Lastly, click the "Create" button to finish.
Adding SkEditor API from Nuget
- Right click the project in
Solution Explorer
and clickManage Nuget Packages
. - Search for
SkEditor
and install it.
You can also use the .NET CLI: dotnet add package SkEditor
Writing the Code
Now you're set to write some code.
Start by ensuring your main class inherits from IAddon from the SkEditor.API
namespace. Then, implement all of the required interface fields and methods.
Here's an example class for reference:
using SkEditor.API;
namespace SkEditorTestAddon;
public class TestAddon : IAddon
{
public string Name => "TestAddon";
public string Identifier => "TestAddon";
public string Version => "1.0.0";
public string? Description => "A test addon for SkEditor";
public Version GetMinimalSkEditorVersion() => new(2, 8, 0);
public void OnEnable()
{
SkEditorAPI.Windows.ShowMessage("Enabled!", "TestAddon enabled!");
}
}
Using the Addon
To use your addon:
- Select your release configuration: when you're ready to release your addon, you should change the configuration to
Release
at the top of Visual Studio. - Right click the project in
Solution Explorer
and clickPack
. - Copy
YourAddonName.dll
fromYourProjectName\bin\Release\net8.0
or similar folder. - And paste it into
%appdata%\SkEditor\Addons