SQLiteDBExample
An SQLite Database example for Unity
Install / Use
/learn @HuvaaKoodia/SQLiteDBExampleREADME
SQLite DataBase Example
Allows reading and writing to an SQLite database from Unity.
Works in the Unity Editor and as a 64-bit Windows build.
Based on http://answers.unity3d.com/questions/743400/database-sqlite-setup-for-unity.html
Step by step instructions for any DIY programmers:
Getting hold of the required DLLs:
- Download 64-bit sqlite Precompiled Binaries for Windows from http://www.sqlite.org/download.html
- Copy Mono.Data.Sqlite.dll & System.Data.dll from Unity folder (for example: "C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0")
- Add all three DLLs to the "Assets/Plugins" folder in the Unity project.
Creating a database:
- Create an SQLite database your program of choice (for instance: http://sqliteadmin.orbmu2k.de/)
- Add the database to the "Assets/StreamingAssets" folder
Working with the database (example code):
Opening a database:
string conn = "URI=file:" + Application.streamingAssetsPath + "/"+name;
dbconn = new SqliteConnection(conn);
dbconn.Open();
Running a query:
IDbCommand dbcmd = dbconn.CreateCommand();
dbcmd.CommandText = "SELECT * FROM Table";
IDataReader reader = dbcmd.ExecuteReader();
dbcmd.Dispose();
dbcmd = null;
Iterating the query (depends on your database, of course):
while (reader.Read())
{
var id = reader.GetInt32(0);
var value = reader.GetInt32(1);
Debug.Log("ID = " + id + " VALUE = " + value);
}
Closing the database:
dbconn.Close();
dbconn = null;
The DataBaseLoader class has a simple public interface for this functionality.
Making a build:
- Set the "API compatibility level" in Unity Player Settings to ".NET 2.0"
- Set the Windows Build Architecture to "x86-64"
- Build
Related Skills
feishu-drive
339.5k|
things-mac
339.5kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
339.5kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
yu-ai-agent
2.0k编程导航 2025 年 AI 开发实战新项目,基于 Spring Boot 3 + Java 21 + Spring AI 构建 AI 恋爱大师应用和 ReAct 模式自主规划智能体YuManus,覆盖 AI 大模型接入、Spring AI 核心特性、Prompt 工程和优化、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、AI Agent 开发(Manas Java 实现)、Cursor AI 工具等核心知识。用一套教程将程序员必知必会的 AI 技术一网打尽,帮你成为 AI 时代企业的香饽饽,给你的简历和求职大幅增加竞争力。
