Data Table Fundamentals
This guide covers the core setup and editing workflow for Data Tables in PlayMaker.
Asset or Component
A Data Table can live in:
- A Data Table Asset for project-wide data you want to reuse across scenes
- A Data Table Component for data that belongs to one scene object
Basic Workflow
- Create a Data Definition and add the fields you need.
- Create a Data Table Asset or add a Data Table Component to a GameObject.
- Assign your Data Definition to the table.
- Add rows and fill in values.
- Use PlayMaker actions or widgets to read, add, remove, sort, and display rows.
Choosing Asset vs Component
Use a Data Table Asset when:
- You want shared data across multiple scenes
- You want to reference the same table from many FSMs
Use a Data Table Component when:
- The data belongs to one scene object
- You want scene-local data that is easy to inspect in context
If you want to edit tables as CSV files, see Data Table CSV Import and Export for the import/export differences between DataTableAsset and DataTableComponent.
Editing and Runtime Behavior
A Data Table supports common row operations:
- Add rows
- Remove rows
- Clear all rows
- Move rows (reorder)
- Sort rows
- Trim to a maximum row count
Rows also support key-based lookup, so you can find a row by a stable key when needed.
Write Policy
Data Tables can be configured to control editing at runtime:
Writable: rows can be changedReadOnly: rows cannot be changedReadOnlyIfAsset: asset-backed tables are protected, component-backed tables can still be edited
Save Mode
Data Tables include a Save Mode setting, which integrates with PlayMaker's save system. Use this when your table data should persist between sessions.
Practical Example
Imagine a shop menu:
- Data Definition fields:
Id,DisplayName,Price,Icon,Unlocked - Data Table rows: one row per shop item
- FSM actions: update
Unlockedstate, sort by price, or remove limited-time offers
This keeps your FSM logic cleaner because the data structure is centralized and easy to inspect.