I've seen a few posts regarding using Sqlite in Unity, though nothing I try seems to work. Either some basic info is missing from the posts or I'm just doing something wrong. If I do this, as many posts suggest:
import System;
import Mono.Data.Sqlite;
I still get an error message in the compiler:
Namespace 'Mono.Data.Sqlite' not found, maybe you forgot to add an assembly reference?
Assuming that someone can help me get around that basic problem, let's say I want to use Sqlite databases since I plan to publish to iPhone, and iPhone supports Sqlite natively. Is there anything special I need to do? Basically, I use one read-only db for storing game metadata, and one writable db for storing save games.
You might want to use this pure managed code version of SQLite. However keep in mind this .NET port is not an official version by the original author of SQLite.
I haven’t tested it yet but since it’s 100% managed code it should run on any platform (except webplayer of course)
I’m trying to connect to a db.sqlite with basic unity and a IOS license to develop an app for the iphone 4.
I created my db (name.sqlite) and I put this file out of the Assets folder. Then I took the two dll (Mono.Data.SqliteClient.dll and System.Data.dll) and I put this file out of the Assets folder.
In my code (JavaScript) I do the following imports:
import System.Data;
import Mono.Data.SqliteClient;
When I try to build this code for iOS platform:
import System.Data;
import Mono.Data.SqliteClient;
private var connectionString: String;
private var dbcon : SqliteConnection; //the instantiation of this creates errors
...
...
this generated the following error:
ArgumentException: The Assembly Mono.Data.SqliteClient is referenced by Assembly-UnityScript. But the dll is not allowed to be included or could not be found.
Error building Player: Extracting referenced dlls failed.
Exception: Error building Player: Extracting referenced dlls failed.
you’ll need to write a plugin for iOS if you want to use Coccoa’s native SQLite as you say it is your intention. The asset below does that for a commercial price. It will also allow to build for any platform with the same single c# code in Mono Develop. It is salty but worthwhile.