c# - How to make Sqlite work for Android with Unity and SQLiteUnityKit -


to make unity app android, need use sql, , looks sqlite supported on every platform. despite this, i'm having following issue:

i using sqliteunitykit, , looks lot of people have been using framework building sql app.

here code tried make work doc:

public class databasemanager : monobehaviour { sqlitedatabase sqldb;  public text firstname;  void awake()  {     string dbpath = system.io.path.combine (application.persistentdatapath, "game.db");     var dbtemplatepath = system.io.path.combine(application.streamingassetspath, "default.db");      if (!system.io.file.exists(dbpath)) {         if (application.platform == runtimeplatform.android)         {             www reader = new www(dbtemplatepath);             while ( !reader.isdone) {}             system.io.file.writeallbytes(dbpath, reader.bytes);         } else {             system.io.file.copy(dbtemplatepath, dbpath, true);         }     }     sqldb = new sqlitedatabase(dbpath);     //insert     string query = "insert person values('b', 'david')";     sqldb.executenonquery(query);     query = "insert person values('b', 'alex')";     sqldb.executenonquery(query);     //query     var result = sqldb.executequery("select * person");     var row = result.rows[1];     debug.log("lastname=" + (string)row["lastname"]);     debug.log("firstname=" + (string)row["firstname"]);     firstname.text = (string)row ["firstname"]; } } 

the problem code works fine when launch project can see:

enter image description here

but in android emulator:

enter image description here

there never name coming. stays "my lastname" nothing more placeholder.

edit: tested build project mac application , runs without problem.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -