Skills Projects About Contact

DataSmith

Open-Source ORM plugin for Unity3D

Documentation
← All Projects

Role

Programmer, Owner

Tech

Unity, C#, Reflection, Editor Scripting

← All Projects

01

The Problem

Unity has no first-class solution for persisting structured gameplay data to a database. The common approaches — hand-writing SQL strings, using PlayerPrefs for everything, or pulling in heavyweight ORM libraries not designed for games — all create the same problem: fragile, boilerplate-heavy code that breaks when your data model changes.

DataSmith solves this by bringing an ORM-style developer experience into Unity — you define your data model once using C# attributes, and DataSmith generates the strongly-typed models, table mappings, and fluent query API automatically. No SQL strings. No reflection at runtime. No boilerplate.

02

How It Works

01
Define your model
Annotate a C# class with DataSmith attributes — column names, types, primary keys, relationships. No SQL, no schema files.
02
Code generation
DataSmith reads your attributes and generates strongly-typed accessor classes and query builders at edit time — zero runtime reflection overhead.
03
Query with fluent API
Use the generated fluent API to read, write, filter, and update records. Fully type-safe. Works with SQLite and custom file-based backends.
03

Features

//
Zero Runtime Reflection
Code generation happens at edit time. At runtime, all accessors are strongly-typed compiled code — no reflection overhead, no boxing, no allocations from the ORM layer.
{ }
Attribute-Driven Models
Define your entire data schema in C# using custom attributes. DataSmith reads the class definition and generates everything else — models, queries, and table mappings.
~
Fluent Query API
Generated query builders support chained, lazy evaluation — filter, sort, join, and project records without writing SQL or building query strings manually.
#
Strongly-Typed Accessors
All generated getters, setters, and event callbacks are fully typed. Rename a field and the compiler tells you everywhere it breaks — no string-keyed lookups.
SQLite + File Backend
First-class SQLite support for persistent gameplay data. Custom file-based backend for lightweight, portable storage — no external dependencies required.
Centralized Architecture
DataSmith enforces a single source of truth for data access. No scattered PlayerPrefs calls or ad-hoc serialization — all data flows through the same typed layer.
Strongly-Typed Events
Generated change events fire when data is written — subscribe to model changes with typed delegates rather than polling or manual observer wiring.
Designer-Friendly
Works inside the Unity Editor with custom inspector integration. Non-programmers can browse and edit data records without touching code or raw database files.
04

Why It Matters

Building tooling that other developers actually use

Writing gameplay code is one skill. Writing a framework that other programmers build on top of — with a coherent API, zero-overhead guarantees, and enough flexibility to fit real project structures — is a different level of engineering entirely.

DataSmith required designing a code generation pipeline that correctly handles C# type reflection at edit time, emits valid compilable output, and stays in sync as models change. It also required thinking about the developer ergonomics of the API — making the fluent query interface feel natural to Unity developers who have never used an ORM before.

Publishing it as open-source and targeting the Unity Asset Store means it has to work reliably across different Unity versions, project configurations, and use cases — with documentation and examples that let someone new get started without help.

05

Links

Documentation
arijeetbaruah.github.io/DataSmith ↗
Full API reference, getting started guide, and examples.
Source Code
github.com/arijeetbaruah/DataSmith ↗
Open-source. PRs and issues welcome.
Unity Asset Store
Coming soon. Will be available as a package directly importable via the Package Manager.
Stack
Unity3D · C# · Editor Scripting · Code Generation · SQLite · Custom file backend