Serializable Matrix


Key features Works with all Unity-supported serializable types: ints, floats, bools, strings, ... Great for ... Puzzle boards (match-3, sudoku, chess, sliding puzzles) ... Requirements


by MKM Tools


Price History +

Fully serializable Matrix (2D Array) for all Unity-supported types. Build tile maps, inventories and puzzle grids with a clean inspector and dedicated editor window.

Key features

  • Generic Matrix<T>: a serializable 2D matrix that works with every type Unity can serialize (primitives, strings, enums, vectors, colors, UnityEngine.Object references, custom [Serializable] classes and structs)
  • Serialized as a flat list plus row and column counts, so it works with prefabs, ScriptableObjects, scenes, and JSON
  • Custom Inspector built with UI Toolkit (PropertyDrawer, bound PropertyField cells)
  • Dedicated Editor Window for editing large matrices
  • Insert row, insert column, remove row, and remove column at editor time and at runtime
  • Full Undo/Redo support for every edit
  • Prefab override support (Revert and Apply work on matrix data)
  • Inspector refreshes automatically when the matrix is modified from code at runtime
  • Simple API: row/column indexer, Rows, Cols, Resize, InsertRow, InsertColumn, RemoveRow, RemoveColumn, AddRow, AddColumn
  • Bounds checking with clear exceptions on invalid indices
  • Full source code, documentation, and sample scenes included

Technical notes

  • Editor UI: UI Toolkit only (no IMGUI)
  • Minimum Unity version: 2022.x
  • Render pipelines: Built-in, URP, and HDRP (editor and data tool, no rendering dependency)
  • Dependencies: none
  • Platforms: all platforms Unity supports (the editor code is editor-only and stripped from builds)
  • Code: C#, source included, editor code in a separate Editor assembly definition

Unity can't serialize multidimensional arrays (T[,]), so grid-based data usually ends up in hacky wrappers or flattened lists. Serializable Matrix fixes that with a generic Matrix<T> that Unity saves, loads and displays in the Inspector like any other field. It comes with a full UI Toolkit editor, so you can build and tweak grids visually instead of wiring up custom tooling for every project.


Key features

  • Works with all Unity-supported serializable types: ints, floats, bools, strings, vectors, colors, enums, ScriptableObjects, prefabs, sprites, custom [Serializable] classes and more
  • Custom Inspector built with UI Toolkit: view and edit matrices as a clean grid directly on your components and ScriptableObjects
  • Dedicated Editor Window: a larger workspace for comfortably editing big matrices
  • Resize on the fly: change the matrix size in both the Inspector and the Editor Window
  • Insert and remove rows and columns without losing the rest of your data
  • Full Undo/Redo support for every edit
  • Prefab override support: edit matrices on prefab instances, with overrides, Revert and Apply working as expected
  • Simple API: access cells by row and column, just like a normal 2D array
  • Documentation and sample scenes included: get started in minutes with ready-made examples
  • Clean, documented source code that is easy to extend

Great for

  • Tile maps and level layouts
  • Inventory and crafting grids
  • Puzzle boards (match-3, sudoku, chess, sliding puzzles)
  • Cellular automata and procedural generation seeds
  • Lookup tables, damage, or type-effectiveness charts
  • Any design-time data that naturally fits rows and columns

Is it customizable? Is it genre-specific?

Not tied to any genre. It's a data tool, so it fits 2D, 3D, strategy, RPG, puzzle, roguelike or simulation projects. You choose the element type, so the same matrix can hold anything from a bool mask to a full custom struct. Full source code is included, so you can adapt the inspector and window to your own workflow.

Requirements

  • Unity 2022.x or newer
  • Compatible with Built-in, URP, and HDRP, since it's an editor and data tool with no rendering dependency
  • Full source code, documentation and sample scenes included