Skip to content
SheetForge

Set up a plugin

Create the assembly that holds your plugin, declare the plugin format it was built against, and decide where generated code lives. This page also covers loading the generated databases at runtime and detecting SheetForge from another asset.

Create the plugin assembly

Create a folder with its own .asmdef that references SheetForge.Core. That is the whole setup.

If you need runtime lookup or ship a delivery loader, reference SheetForge.Runtime as well. Write the runtime half describes the loader.

The Editor's PluginRegistry discovers your ISheetForgePlugin implementation through TypeCache and calls your registration methods. Registration is your explicit code, not an assembly scan.

Add an editor companion assembly

Keep the Core-contract implementations in the main assembly. The implementations of the five Editor contracts, IStudio* and ISheetSourceProvider, go in an editor-side companion assembly. That assembly references SheetForge.Editor as well.

The browser loads only your main DLL. A Core contract implemented in the editor companion is silently missing there.

Declare compatibility

An assembly-level attribute states which generation of the plugin format your assembly was built against, and the lowest host it wants. The declaration is optional and takes one line.

using SheetForge.Core.Plugins;
 
[assembly: SheetForgePluginCompat(
    SheetForgePluginFormat.Current,          // the generation constant of the SDK you compiled against
    MinHostVersion = "0.1.0",                // optional — omit for "any host"
    PluginVersion  = "1.0.0")]               // optional, display only

Assemblies with no declaration

Omitting the attribute is fine. An assembly with no declaration is read as generation SheetForgePluginFormat.Minimum with no host requirement. Plugins written before the attribute existed load exactly as they did.

What a rejection removes

The unit of judgment is the assembly. A rejected assembly loses all of its registrations.

A per-type declaration would let an undeclared neighbor type through. It would leave you with an assembly that was refused, but half of it registered.

How a rejection is reported

Rejection is a PluginIncompatible diagnostic, not a silent disappearance. The diagnostic names what the assembly declared and what this host reads.

How compatibility is decided

The host decides compatibility from the attribute compiled into the DLL, not from the market listing.

The market registry advertises the same two values, pluginFormat and minHost, so a listing can be filtered before download. The gate reads the attribute out of the verified bytes, because a listing can be wrong and the compiled declaration cannot.

The attribute is a compatibility declaration, not a signature. Integrity is the distribution channel's job. See Hash check.

When the generation number moves

The generation number moves only if the plugin format itself is replaced.

Purely additive growth, such as a new contract or a new member on a registration object, never moves it, because your existing plugin keeps running without a recompile.

Place generated code

Two fields of the settings asset decide where generated types live: Generated Code Folder (generatedCodeFolder) and Generated Namespace (generatedNamespace).

Choose the folder

Generated Code Folder may be any folder. If generated code references plugin types that the folder's assembly cannot see, the import automatically emits a companion .asmdef there to wire the references. See Generated code folder.

Placing the folder inside your package is tidiest, for example Assets/MyDomain/Runtime/Generated. Generated types then compile in the same assembly as your enums and custom types, and no companion asmdef is needed.

Per-tab home

A tab whose generated type already exists somewhere is regenerated in place. Your package's committed Generated folder stays authoritative even if the settings point elsewhere.

Stale duplicates are cleaned automatically. The cleanup is logged, never silent.

Choose the namespace

Generated Namespace isolates your generated types, for example in MyGame.Data.

Any namespace works. Type discovery uses the generated types' intrinsic SchemaFingerprint marker, not the namespace.

Changing the value triggers regeneration automatically.

Commit the generated folder

Whether to commit your package's Generated folder is your package's policy.

The reference sample commits its folder, so a fresh clone compiles immediately. Its classes are Example* classes in the default namespace, SheetForge.Generated. They come from the tabs ExampleSkills, ExampleEffects and ExampleActions.

The sample does not use a separate namespace. The Example* class-name prefix is what keeps its classes from colliding with your project's real Skills and Effects tabs.

Load the databases at runtime

Your runtime reads the generated databases and dispatches on the type enum to the code that runs each behavior. No embedded scripting language is needed. Compose complex data by reference describes how to lay out the tabs.

The example loads the three tabs of the reference sample: ExampleSkills, ExampleActions and ExampleEffects.

using SheetForge.Runtime;
using SheetForge.Generated;
 
var hSkills  = SheetForgeDatabases.LoadAsync<ExampleSkillsDatabase>("ExampleSkills");
var hActions = SheetForgeDatabases.LoadAsync<ExampleActionsDatabase>("ExampleActions");
var hEffects = SheetForgeDatabases.LoadAsync<ExampleEffectsDatabase>("ExampleEffects");
var runner = new SkillRunner(await hSkills, await hActions, await hEffects);
// keep the handles for the system's lifetime; Release each on shutdown

The handles are SheetForge's own SheetForgeLoadHandle<T>, the same type in every delivery mode.

Procedural one-off logic

For truly procedural one-off logic, reference a script asset through AssetRef. In a project that delivers without Addressables, use DirectRef. SheetForge validates the reference and bakes it, exactly like an image. Executing it is the game's job.

Procedural logic shows the column type to use.

Detect SheetForge from another asset

A different asset can detect that SheetForge is installed. This is for an asset that integrates with SheetForge rather than extends it, such as a stat system.

A paid Asset Store product is a folder product, with no package.json and no UPM. It cannot ship a versionDefines entry. Instead, SheetForge's Editor assembly self-registers a SHEETFORGE scripting-define symbol on every build target.

Detect at compile time

Compile-time detection is the preferred way.

If your integration lives in its own assembly definition, add SHEETFORGE to that asmdef's Define Constraints. The assembly then compiles only when SheetForge is present.

If SheetForge-touching code shares an assembly with code that must compile regardless, guard just those parts with #if SHEETFORGE … #endif.

Detect at editor time

Editor-time detection is the alternative. When you cannot rely on compile order, probe by reflection.

For example, test System.Type.GetType("SheetForge.Editor.Pipeline.ImportEvents, SheetForge.Editor") != null. Then wire up the integration dynamically, for instance the import-completed events that Import events describes.

What the define means

SHEETFORGE means "SheetForge is installed".

It is separate from SHEETFORGE_ADDRESSABLES. That symbol is an internal version-define on SheetForge's own assemblies. It only marks whether the Addressables package is present. Do not use it as an install probe.

The define is not removed automatically

The define persists if SheetForge is later removed. There is no watcher to un-set it. Remove it by hand in Project Settings ▸ Player. See The product-detection define.

Next steps