Skip to content
SheetForge

Core concepts

SheetForge turns a sheet into validated data, typed code and loadable assets. This page explains the model behind that: which form of your data is the truth, what is derived from it, and how the pieces stay consistent.

The sheet is the single source of truth

A sheet, also called a tab, is one table of your data: a file in a local folder, a sheet of an xlsx file, or a tab of a Google spreadsheet. "The sheet" also stands for your source data as a whole. Terms explains both words and the other product terms.

A project that treats the baked ScriptableObject (SO) as the source of truth ends up with unvalidated data that drifts from the sheet. It has no way to reconcile the two.

SheetForge keeps exactly one canonical form of your data: the sheet. Everything else is derived.

  • The intermediate representation (IR) is the validated, assembled form of the sheet. It is made of immutable Definitions.
  • The generated C# classes are the IR's schema, made strongly typed.
  • The baked ScriptableObjects are the IR's values, made loadable. They are a lookup cache, never an independent truth.

All modification goes through the sheet and must pass re-import validation to become real. Editing a baked SO directly would create a second truth and bypass validation, so the product deliberately does not support it as a workflow.

You never reconcile the sheet and the baked data by hand. Every import regenerates the baked data from the sheet.

Note

The Inspector of a baked database has a Test edit (temporary — not written to the sheet) toggle for temporary runtime experiments. A test edit is never written back, and re-import erases it. See Try values on a baked asset.

The IR

The IR is what validation produces. It is an immutable, validated assembly of the sheet.

For each tab, the IR holds a SheetTable (schema + records) whose cells are already typed values: int, float, enum values, record references, asset references, lists and custom plugin types.

The IR has three key properties:

  • It is never partially assembled. If a single error exists anywhere, the IR is not built. ImportResult.Success == false ⇔ Registry == null is a hard invariant.
  • It holds no nulls. An empty optional cell materializes its type default immediately, flagged IsDefaulted. Consumers never null-check.
  • It is immutable. The IR is read-only after assembly. The exits, which are the steps that write the data out (codegen, bake, export), read it and never mutate it.

The pipeline

One import run takes a sheet through these stages:

fetch → parse markers/schema → parse cells → validate (keys, references,
@overlap, asset keys, domain rules) → assemble IR → codegen (.cs) → bake (SO)
       └──────────────── collect ALL diagnostics ────────────────┘

Validation collects everything

You get the complete list of problems in one run, instead of fixing one error per re-import. Each error says where, what, why and how.

Structured errors

Errors are structured objects, rendered as sentences. Each error carries:

  • the tab
  • the 1-based row
  • the column letter and the field name
  • the offending value
  • the violated rule
  • an actionable suggestion, with nearest-match proposals for typos

The same objects also render as machine coordinates for logs and CI.

Codegen runs last

Codegen is the last stage, after validation and value assembly, because writing .cs files triggers a domain reload. The pipeline is structured so that the reload is safe and the chain resumes automatically after it.

The automatic import chain

When a schema is new or changed, one import run does two things internally:

  1. It writes the generated code. Unity compiles, and the domain reloads.
  2. After the reload, the chain resumes by itself and completes the bake.

The stages are codegen → compile → bake, and they run from one user action. You never re-trigger anything manually. The Console prints the final report when the bake is done.

If compilation fails, the chain stops at once and does not retry. This happens, for example, when your game code references a field that a rename just changed. The Console gets a sentence that says what to do. Fix your code and import again.

One more safeguard and one trace watch the chain: an attempt cap of 3 stops a chain that keeps asking to resume, and the Console logs each resume.

Strong typing, no runtime parsing

Codegen reads the markers @name, @type and @desc, and emits two classes per tab. For a tab named Foo:

ClassRole
FooDefinitionA strongly-typed record class, one field per column
FooDatabase : DefinitionDatabaseThe per-tab container SO with Records, lazy id lookups, and a SchemaFingerprint

@desc becomes the XML doc comment and the inspector tooltip.

The tab name is also the key that game code loads by, as Address loading shows.

The bake writes real typed fields. There is zero runtime text parsing and no runtime reflection, which makes the data IL2CPP-safe (no stripping hazards).

Address loading

Baked SOs are per-machine caches. A baked database's GUID is deterministic, derived from its tab name, so the same tab bakes to the same GUID on every machine. A direct reference therefore does not go Missing on a teammate's machine: it resolves once that machine has run an import.

Game code still reaches a database through the loader, never through a hand-made scene reference, even though such a reference survives a re-import. The loader keeps game code identical in every delivery mode, which is how baked databases reach the game. The settings asset chooses the mode, and the import hands each Database SO to it:

  • The Addressables (recommended) mode registers it in the group SheetForge at the stable address "SheetForge/{tab}". Re-bakes re-link the same address, and deleted tabs are cleaned up.
  • The Resources folder mode writes it to {Resources folder}/SheetForge/{tab}.asset.
  • The Scene catalogue (no Addressables, no Resources) mode bakes a catalogue asset next to it.

Each workbook, which is one settings asset, chooses its own mode, and two workbooks may differ. Each workbook's generated registration tells the runtime which tabs arrive by which mode. To compare the modes, see The three modes.

The one direct reference the product asks for is the catalogue asset of the scene catalogue mode. Its GUID is derived from the workbook's settings asset, so it resolves on every machine.

Loading from game code

Game code is the same in every mode. SheetForgeDatabases.LoadAsync<FooDatabase>("Foo") returns a SheetForgeLoadHandle<FooDatabase>.

In the Resources mode, Resources.Load<FooDatabase>("SheetForge/Foo") is a fully supported route as well, because the key is the Resources path. The loader is the one that stays correct whatever the mode.

Baselines and round-trip

On import, SheetForge stores a normalized snapshot of each tab's structure: marker rows, column order, comments and human-written text. This snapshot is the baseline.

Export then swaps the current SO values into the baseline structure. A sheet → import → Export → sheet round-trip therefore preserves your sheet 100% structurally, and preserves values semantically:

  • 1.0 ↔ 1 is allowed because the value is identical.
  • Floats use the shortest round-trip format.
  • The decimal separator is always ., locale-independent.

One settings asset is one workbook

A settings asset names a sheet source, an output folder and a generated namespace. That bundle is a workbook. The tabs that the source holds belong to that workbook.

A project may hold as many workbooks as it needs: one per team, per feature, per add-on. They coexist all the way through: baked assets, generated code, delivery registrations and the pre-build freshness check.

The active set

The workbooks you are working on form the active set. The set is per user and per project, and it is never committed. ↓ Import in the Data Studio toolbar imports every active workbook, referenced workbooks first. The active set shows where you tick a workbook. The same chapter covers how the Data Studio shows several workbooks, and what happens to edits you have not yet written to the source when you open another workbook.

Baselines per workbook

Each workbook keeps its own baselines, under Library/SheetForge/Baseline/<settings GUID>. Importing one workbook never disturbs another's snapshots.

Each workbook also keeps its own quarantine mark. A sheet that fails validation is quarantined: it opens in the Data Studio for fixing, and Export and Push stay shut. A workbook whose sheets fail validation blocks its own Export and build rather than everyone else's.

An import of one workbook can break references that another workbook holds into it. The workbook that holds the broken references then gets a block of its own, separate from its quarantine mark, and its Export, Push and player builds are refused. The block clears itself when that workbook is imported again and found whole. See The block that follows.

Project-wide unique names

Tab names and sheet-defined enum names are unique across the whole project. A tab name becomes the load key (SheetForge/{tab}) and the generated type name ({tab}Database), so two workbooks cannot both own one.

This holds whatever delivery modes the workbooks use.

An import that would collide is refused. The refusal names the settings asset that already owns the name. It lists every collision at once, so you can rename them in one pass.

The same rule lets a sheet in one workbook reference a tab or an enum in another with the ordinary notation. RecordId@Items can only mean one tab. See Reference notation.

Cleanup of orphaned files

Cleanup respects the other workbooks. An orphaned baked asset or generated file is removed only when no workbook owns that tab. In the Addressables mode, the same holds for an orphaned Addressables entry.

The two shared generated files are the enum collection and the localization key constants. They hold the material of every workbook that generates into that folder. Each workbook has its own namespace block, taken from what that workbook last generated. Importing one workbook does not drop what another contributed.

Pull every workbook

Pull every workbook is shown when the project holds more than one workbook. It stands beside ↓ Import in the Data Studio toolbar when a Google Sheets workbook is in the active set. Otherwise it is in the toolbar's ⋯ menu and in the menu of the last-import status on the status bar. The Getting Started window has it too. It imports every workbook, referenced workbooks first.

The run carries on across the domain reloads that code generation causes. It restores the workbook that was open when you started, and reports one summary at the end.

Workbooks may use different delivery modes. A workbook that cannot run in its mode, such as an Addressables workbook with the package missing, counts as one failure in that summary. The rest still run.

From code, use one of these calls:

CallWhat it imports
SheetForgeActions.RunImportAll()All workbooks
SheetForgeActions.RunImportActive()The active set
SheetForgeActions.RunImport(settings)A single named workbook

Shared output folders

Workbooks may share an output folder and a generated namespace if you want them to. The per-tab identity is what keeps the artifacts apart.

When two workbooks do not share a folder and one uses the other's enum, the generated assembly references are wired for you. This works only as long as the two do not use each other's enums.

What is committed and what is regenerated

ArtifactPolicy
Sheets (local files) or the Google sheetThe truth. Committed or shared
Baked Database SOs (Assets/SheetForgeBaked)Gitignored per-machine cache. Regenerate by running an import
Generated code (Assets/SheetForgeGenerated)Commit it (the recommendation)
Addressables SheetForge group assetGitignored, self-healing
A domain package's own Generated folderThe package's own choice
Import settings assetYours to manage, and safe to commit

Baked databases

Baked Database SOs are a per-machine cache, so each machine runs an import once. After cloning, each teammate presses Run Import in the Getting Started window. ↓ Import in the Data Studio toolbar runs the same import.

When the project holds several workbooks, each teammate runs Pull every workbook instead. That import also records which workbook owns each generated enum. A fresh clone cannot know that otherwise.

Generated code

Committing the generated code is the recommendation, for four reasons:

  • It is your project's source.
  • It lives outside Assets/SheetForge, so reinstalling the product cannot delete it.
  • A fresh clone compiles before anyone runs an import.
  • Schema changes show up in review.

The output is deterministic, so teammates' imports produce identical bytes and create no churn.

Gitignoring the generated code is a valid alternative. The import that each teammate runs after cloning regenerates the code, and that import is what restores compilation.

A project that predates this default keeps generating into Assets/SheetForge/Runtime/Generated until that folder is empty. See What the deletion touches.

Addressables group asset

The Addressables group asset is gitignored and self-healing. Import recreates it when it is missing. Don't commit the one-line settings diff that its first creation makes.

The group asset exists in the Addressables mode only.

Domain package code

What a domain package does with its own Generated folder is the package's own choice. The bundled SheetForge.PluginDemo sample commits its generated code so the demo compiles immediately on import.

Import settings asset

The import settings asset is yours to manage, and safe to commit. It holds no key material, not even a path.

The service-account key path is a per-user setting (⚙ Settings in the Data Studio toolbar) or the SHEETFORGE_SHEETS_KEY environment variable. See Tell SheetForge where the key is.

Extension without modification

Registration contracts let plugins join the pipeline with zero Core edits. Plugins can register:

  • cell-type parsers (including wrapper types), domain validators and edge contributors
  • custom structural markers, Create sheet templates and import-source providers
  • the Data Studio's canvas overrides, code registries, widgets, actions, cell widgets, color presets and UI strings

Core never references a domain package. The compiler enforces the one-way dependency. The authoritative list, and its count, lives in What a plugin can add.

Terms

The documentation uses these product words. Where a word has a section of its own, the entry links to it.

  • tab: one table of your data. A tab is a file in a local folder, a sheet of an xlsx file, or a tab of a Google spreadsheet. Each tab generates its own classes and bakes to its own database.
  • sheet: another word for a tab. The product's labels use both words, so these pages do too. "The sheet" also stands for the source data as a whole.
  • workbook: one settings asset, with the source, the output folder and the namespace it names. See One settings asset is one workbook.
  • staged edit, staging: an edit that the Data Studio holds and has not yet written to the source. See How an edit reaches the sheet.
  • reflect: writing the staged edits to the source. The toolbar button ↑ Send runs it. See How an edit reaches the sheet.
  • Push: sending baked values to a live Google sheet, cell by cell. See Push to Google Sheets.
  • baseline: the snapshot of a tab's structure that an import stores. See Baselines and round-trip.
  • pre-flight: the validation that runs before a reflect writes anything. See Validation before a write.
  • quarantine: the state of a sheet that failed validation. It opens for fixing, and Export and Push stay shut. See Open a sheet that failed validation.
  • isolated edit: a staged edit whose row can no longer be found in the sheet. See Isolated edits.
  • draft badge: the mark on the Problems panel while a key rename is staged. See Problems during a staged key rename.
  • terminus: the record the canvas is opened on. See What the canvas draws.
  • IR: the intermediate representation, which is the validated, assembled form of the sheet. See The IR.
  • delivery mode: how baked databases reach the game. See The three modes.
  • active set: the workbooks you are working on. See The active set.

Next steps