Unity SQL Database?

I have many variables that need to be stored in player prefs for saving and loading, is it possible to store these variables in a database and then use SQL to call these various variables from the database, then to save the database and the next time the player plays the game it will just recall all the variables from the original database (after they have been edited)

for example if the player is using a sword with +5 damage, I could store that in a database, then the next time the player upgrades his sword to +9 damage I could Update that in the database using (UPDATE tblSwords SET damage = 9) or something along those lines, instead of constantly having to save and load player prefs?? is this possible?

You can use the SQLite in Mono if you want - you just need to copy the “Mono.Data.dll”, “Mono.Data.Sqlite.dll” and “Mono.Data.SqliteClient.dll” files from “C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0” (or whatever is the equivalent dir for you) somewhere under your projects asset folder (don’t think it matters where), and then the “Mono.Data.SqliteClient” namespace should be available for use.

hi, you can use this code its easy to use and its free for your individual use,

use example:

SqliteDatabase sqlDB = new SqliteDatabase(“config.db”);
string query = “INSERT INTO User(UserName) VALUES( ‘Santiago’)”;
sqlDB.ExecuteNonQuery(query);

its so easy… the file “config.db” is necessary exist in the “StreamingAssets” folder

i hate the people who sell this things in the assets store, something easy like this… we need more open sources users :slight_smile:

link — > click here to download

link — > GitHub Repository

works on iOS, MAC OSX, Windows, i dont sure if works on web and android, if you test in that OS tell me the result… thanks

Apply mssql fix database

Article http://www.sqlserver.fixtoolboxx.com will help you to give the proper understanding about sql databases