Skip to content

Schema and Storage

This page covers the core data types that define and store PlayMaker data.

DataDefinition

DataDefinition is a ScriptableObject that defines a schema: a list of fields with types and default values.

Responsibilities

  • Defines the authoritative field list for DataTable rows
  • Defines the authoritative field list for DataRecord instances
  • Provides the schema used for UI binding validation
  • Identifies fields by SerializableGuid, not by name

Using GUIDs makes schema evolution safer because fields can survive renames and refactors.

Used By

  • DataTable
  • DataRecord
  • UI binding systems
  • FSM actions

DataTable

DataTable is a serialized type that represents a table of rows for a given DataDefinition.

Structure

DataTable
  -> List<DataRow>
       -> List<Cell>  (FieldGuid -> IVariableVar)

Notes

  • Rows may have an optional string Key
  • Rows always have a stable RowId (SerializableGuid)
  • The table does not assume any specific UI usage

DataTableSource

DataTableSource is a wrapper that lets runtime actions target either of these:

  • DataTableAsset for shared asset data
  • DataTableComponent for per-GameObject data

This lets FSM actions work with both sources through the same abstraction.

DataTableAsset

DataTableAsset is a ScriptableObject that stores a shared DataTable.

Use it when multiple scenes, prefabs, or systems should reference the same table asset.

DataTableComponent

DataTableComponent is a MonoBehaviour that attaches a DataTable to a GameObject.

Typical uses include:

  • Runtime-editable tables
  • Scene-specific data
  • Prefab-scoped data

DataRecord

DataRecord is a serialized type that represents a single record of values for a DataDefinition.

It is useful when data should travel as one unit, such as:

  • Event payloads
  • Inputs and outputs
  • Single-object state

DataRecordComponent

DataRecordComponent is a MonoBehaviour exposed to users as the Data Component.

It attaches a DataRecord to a GameObject.

Responsibilities

  • Provides object-level data storage
  • Raises Changed events when values change
  • Allows FSM actions to get and set object data

Utility Method

DataRecordComponent.FindMatching(GameObject go, DataDefinition def)