Plugin authoring
A domain such as skills, items or quests joins SheetForge as a separate package that references SheetForge.Core. Core never references it back, so adding a domain changes zero Core lines.
What a plugin can add
A plugin implements any of sixteen contracts. Between them, the contracts add:
- enums, custom cell types and wrapper types
- domain validators and graph edges
- structural markers and Create sheet templates
- whole import sources
- the Data Studio's canvas overrides, code registries, widgets and actions
- declarative authoring surfaces and custom cell widgets
- color presets
- pipeline observers
- the plugin's own localized UI strings
All sixteen contracts are discovered automatically. A parameterless constructor is the whole requirement. There is no assembly reference, registration call or manifest to edit.
In this chapter
- Set up a plugin: create the assembly, declare compatibility, place generated code and load the data at runtime.
- Enums and cell types: register enums, a custom cell type and a wrapper type.
- Validators and edges: add domain validation rules and graph edges.
- Reference parity: give your own notation the reference handling
RecordId@Tabgets. - Markers and templates: add structural markers and Create sheet templates.
- Canvas overrides: override the canvas per tab and expose key spaces that live in code.
- Canvas editing contracts: make your own edges editable on the record canvas.
- Nodes, slots and tokens: create nodes, declare connect slots and edit tokens on the canvas.
- Studio extensions: add graph widgets, inspector actions and custom cell widgets.
- Theming and strings: add color presets, your own UI strings and multi-line text cells.
- Authoring surfaces: describe actions and panels declaratively, or build a panel yourself.
- Pipeline and sources: watch the pipeline, add an import source and use the public automation tools.
- Custom delivery: ship your own delivery mode, a way for baked databases to reach the game.
Core contracts
The eleven Core contracts are pure C#. That lets one compiled plugin DLL light up the same extension slots in the Unity editor and in the browser. See One plugin, two hosts.
| Contract | Registers | Opt-in? |
|---|---|---|
ISheetForgePlugin | Enums and custom cell-type parsers | The base contract |
ISheetForgeValidatorPlugin | Domain validation rules (cross-column / cross-tab) | Opt-in add-on |
ISheetForgeEdgePlugin | Graph-edge declarations that the Core's scan of the data cannot see | Opt-in add-on |
ISheetForgeMarkerPlugin | Custom structural markers (per-column @marker rows) | Opt-in add-on |
ISheetForgeTemplatePlugin | Create sheet templates (tabs and example data) | Opt-in add-on |
ISheetForgeGraphPlugin | Per-tab canvas overrides for the Data Studio (What the canvas shows) | Opt-in add-on |
ISheetForgeCodeRegistryPlugin | Read-only key spaces that live in code, as locked virtual tabs | Opt-in add-on |
ISheetForgeThemePlugin | Color presets for the SheetForge windows (dark and light) | Opt-in add-on |
ISheetForgeStudioPlugin | Declarative authoring surfaces: actions, panels, column badges, cell-editor hints | Opt-in add-on |
ISheetForgeStringsPlugin | Your plugin's UI strings, per language (an overlay consulted before the product tables) | Opt-in add-on |
ISheetForgePipelinePlugin | Pipeline observers: read-only notification of what an import produced | Opt-in add-on |
The add-ons extend the base interface without changing it. A plugin that does not need validation or edges is untouched by their existence.
Composition and isolation of plugins are one shared Core function. Only discovery differs per host: Unity uses TypeCache, and the browser scans the uploaded assembly.
Editor contracts
The five Editor contracts hand back UIToolkit elements or touch window state, so they exist in the editor only. Each one is an independent contract in the Editor assembly.
| Contract | Registers |
|---|---|
ISheetSourceProvider | A whole import source (DB / REST / in-house) |
IStudioGraphWidget | A domain widget above the Data Studio canvas |
IStudioInspectorAction | An extra button on the Data Studio node inspector |
IStudioCellEditorProvider | A custom input widget for one cell type in the Data Studio grid |
IStudioPanelProvider | An arbitrary UIToolkit panel in the Studio, for what the declarative panel cannot describe |
Delivery contracts
Two more contracts stand apart from the sixteen above. Together they are counted as one asset delivery mode.
| Contract | Registers | Opt-in? |
|---|---|---|
IDatabaseDeliveryStrategy | The editor half of an asset delivery mode: where a bake writes, how the result is published, what the mode can deliver | Independent (Editor assembly, discovered) |
IDatabaseLoader | The runtime half of the same mode: how the key "SheetForge/{tab}" becomes a loaded asset | Independent (Runtime assembly, registered by a call) |
The editor half is discovered like the rest. The runtime half is registered with SheetForgeDatabases.RegisterLoader before the first load. See Custom delivery.
Capabilities
Seven further interfaces are capabilities rather than contracts:
- They are not discovered on their own.
- They are implemented in addition by something already registered.
- The Core finds them by casting that registered object.
Six are cast from a registered edge contributor or canvas override. How capabilities are discovered gives the discovery rule. The rest of that page and Nodes, slots and tokens describe each one.
The seventh, IReferencingCellType, is cast from a registered cell parser. It gives your own notation the same reference handling RecordId@Tab gets. See Reference parity.
Ignoring any of them changes nothing.
How zero Core edits is enforced
The rule that adding a domain changes zero Core lines is compiler-enforced.
A test assembly, SheetForge.Tests.Consumer, has no InternalsVisibleTo access. It implements fifteen of the sixteen contracts, and the capability interfaces beside them, using the public surface alone. If any of them were narrowed to internal, the build would fail with CS0122.
The sixteenth contract, IStudioPanelProvider, is the editor-only rich panel. It returns a VisualElement, so an editor-side test exercises it instead.
The reference sample
The full worked example is the sample SheetForge.PluginDemo. It ships as a selective import package, so it is not in your project until you import it. Because the sample ships only as that package, its assemblies, types, tabs and addresses never collide with yours.
To import the sample, press Import Plugin Demo in the Getting Started window (Tools ▸ SheetForge ▸ Getting Started). Plugin demo gives the package file, the folder the import restores, and the demo scene.
The sample paths this chapter references, such as Assets/SheetForge.PluginDemo/ModifierCellParser.cs, exist once you have imported the package.
A second sample, SheetForge.CoreDemo, uses core built-in types only, with no plugin. See Core-only demo.
What still needs Core edits
Everything in this chapter joins with zero Core edits. A plugin still cannot do the following three things without Core changes.
Marker values in generated code
A plugin cannot emit marker values into generated code. Custom markers are validation and display metadata. Baking them into codegen constants or attributes is out of scope until a consumer needs it.
Key renames inside a custom notation
Key-rename propagation cannot reach inside a custom notation without being told how. On its own, the Core rewrites a renamed record in RecordId@Tab cells, lists of them, and wrapper elements.
For your own grammar, implement IReferencingCellType. The key is then rewritten with the rest of the cell text preserved. That is an opt-in, not a Core edit. See Reference parity.
If you decline the opt-in, the boundary stands. Your domain validator reports the dangling key. The rename does not fix it.
Enum members added from a sheet
A sheet cannot add members to a plugin-registered C# enum. An enum registered with enums.Register<T>() is owned by code. An enum definition sheet cannot extend it, and the Data Studio does not offer the row.
If the sheet should own the enum, move the enum into an enum sheet. See Enum sheets.
Extensions that need no Core edit
The <> wrapper type (ICellWrapperType) and the custom structural marker (IStructuralMarkerDefinition) both extend the pipeline without Core edits.
For the wrapper type, see Enums and cell types. For the marker, see Markers and templates.
Next steps
- Set up a plugin
Create the plugin assembly and declare its compatibility.
- API reference
Every contract's full signature.
- Authoring kernel
Edges and the engine surface.
- Plugin extension limits
Wrapper rejection rules, marker limits and reserved seams.