SQLite feels like it should be an obvious fit for Unreal Engine projects — lightweight, file-based, fast, and perfect for things like:
- Save data
- Player stats
- Inventory
- Local game state
- Offline-first tools or editors
But if you’ve ever tried to use SQLite in Unreal, you already know the truth:
It’s not hard — it’s just poorly documented.
This post covers what actually works today in Unreal Engine 5, what to avoid, and when SQLite makes sense (and when it doesn’t).
Why SQLite in Unreal Engine?
SQLite is a great fit when you want:
- Zero external services
- No server dependency
- Simple relational data
- Portable
.dbfiles - Fast reads and writes
Common Unreal use cases:
- Single-player or co-op games
- Editor tools and plugins
- Dedicated servers (local persistence)
- Prototyping before moving to a real backend
The Reality: SQLite Support in UE5
Unreal Engine does include SQLite, but it’s not obvious:
- There is no official “SQLite tutorial”
- The API is low-level
- Most examples online are UE4-era and outdated
In UE5, SQLite support lives in engine modules — but you need to wire it up correctly.
Option 1: Use Unreal’s Built-In SQLite (Recommended)
Unreal ships with SQLite as part of the engine, but it’s not enabled by default.
Enable Required Modules
In your .Build.cs file:
PublicDependencyModuleNames.AddRange(new string[]
{
"SQLiteCore",
"SQLiteSupport"
});
If you’re building a plugin, this goes in the plugin module’s Build.cs.
Opening a SQLite Database
Here’s a minimal example using Unreal’s SQLite API:
#include "SQLiteDatabase.h"
FSQLiteDatabase Database;
bool bOpened = Database.Open(
*DatabasePath,
ESQLiteDatabaseOpenMode::ReadWriteCreate
);
if (!bOpened)
{
UE_LOG(LogTemp, Error, TEXT("Failed to open SQLite database"));
}
ReadWriteCreatewill create the database if it doesn’t exist- Database paths should usually live in:
Saved/ProjectDir()
Executing SQL Statements
FString CreateTableQuery = TEXT(
"CREATE TABLE IF NOT EXISTS PlayerData ("
"Id INTEGER PRIMARY KEY AUTOINCREMENT,"
"Name TEXT,"
"Score INTEGER"
");"
);
Database.Execute(*CreateTableQuery);
For simple inserts and updates, this works fine.
Querying Data
FSQLitePreparedStatement Statement;
Statement.Create(Database, TEXT("SELECT Name, Score FROM PlayerData"));
while (Statement.Step() == ESQLitePreparedStatementStepResult::Row)
{
FString Name = Statement.GetColumnText(0);
int32 Score = Statement.GetColumnInt(1);
UE_LOG(LogTemp, Log, TEXT("Player %s: %d"), *Name, Score);
}
This is verbose, but predictable.
What SQLite Is Not Good At in Unreal
SQLite is not a replacement for:
- Live multiplayer backends
- Large-scale analytics
- Cloud-synced progression
- Highly concurrent writes
If you need those, you’ll want:
- REST APIs
- Dedicated backend services
- Or Unreal’s Online Subsystems
SQLite shines when local, reliable, simple data is the goal.
Packaging & Shipping Considerations
A few gotchas:
- SQLite databases are writable files — don’t store them in packaged
Content/ - Use:
FPaths::ProjectSavedDir()FPaths::ProjectPersistentDownloadDir()
- Make sure your platform allows file writes (especially consoles / mobile)
When I Use SQLite in UE5
Personally, SQLite is my go-to for:
- Prototyping gameplay systems
- Editor tools
- Plugins that need persistence
- Offline-first mechanics
If the project outgrows SQLite, I migrate later — but SQLite is a fantastic starting point.
Security: Preventing SQLite Data Tampering
It’s important to be clear about one thing up front:
Any data stored locally on the client can be modified by the player.
SQLite is just a file, which means anyone with enough motivation can open it, edit it, or replace it entirely. That doesn’t mean SQLite is unusable — it just means you need to design with this reality in mind.
For single-player or offline games, the goal isn’t perfect security — it’s making tampering difficult and detectable. For competitive or monetized games, the solution is almost always to keep the authoritative data server-side.
I go deeper into practical, Unreal-friendly approaches here:
👉 How to Secure a SQLite Database in Unreal Engine
That article covers:
- Encrypting SQLite databases
- Detecting tampered data
- Safe key storage per platform
- What not to trust on the client
- When to abandon local storage entirely
If cheating or save-file manipulation matters for your project, it’s worth reading before you ship.
Final Thoughts
SQLite absolutely works in Unreal Engine 5 — but Unreal doesn’t go out of its way to tell you how.
Once wired up correctly:
- It’s fast
- It’s stable
- It’s predictable
If you need simple persistence without spinning up infrastructure, SQLite is still a solid choice.
Happy coding.