Skip to content
SheetForge

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

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.

ContractRegistersOpt-in?
ISheetForgePluginEnums and custom cell-type parsersThe base contract
ISheetForgeValidatorPluginDomain validation rules (cross-column / cross-tab)Opt-in add-on
ISheetForgeEdgePluginGraph-edge declarations that the Core's scan of the data cannot seeOpt-in add-on
ISheetForgeMarkerPluginCustom structural markers (per-column @marker rows)Opt-in add-on
ISheetForgeTemplatePluginCreate sheet templates (tabs and example data)Opt-in add-on
ISheetForgeGraphPluginPer-tab canvas overrides for the Data Studio (What the canvas shows)Opt-in add-on
ISheetForgeCodeRegistryPluginRead-only key spaces that live in code, as locked virtual tabsOpt-in add-on
ISheetForgeThemePluginColor presets for the SheetForge windows (dark and light)Opt-in add-on
ISheetForgeStudioPluginDeclarative authoring surfaces: actions, panels, column badges, cell-editor hintsOpt-in add-on
ISheetForgeStringsPluginYour plugin's UI strings, per language (an overlay consulted before the product tables)Opt-in add-on
ISheetForgePipelinePluginPipeline observers: read-only notification of what an import producedOpt-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.

ContractRegisters
ISheetSourceProviderA whole import source (DB / REST / in-house)
IStudioGraphWidgetA domain widget above the Data Studio canvas
IStudioInspectorActionAn extra button on the Data Studio node inspector
IStudioCellEditorProviderA custom input widget for one cell type in the Data Studio grid
IStudioPanelProviderAn 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.

ContractRegistersOpt-in?
IDatabaseDeliveryStrategyThe editor half of an asset delivery mode: where a bake writes, how the result is published, what the mode can deliverIndependent (Editor assembly, discovered)
IDatabaseLoaderThe runtime half of the same mode: how the key "SheetForge/{tab}" becomes a loaded assetIndependent (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