The files under the mobile streamingassets are read-only, but you may not be able to read as much as I did when I put the database files under streamingassets after the release of Android.
But in fact this folder is actually readable, so we need to use XML to read the file, and then dump it into the Persistentdatapath directory, the following is the code:
1 Public Static classConfig2 {3 Public Static stringfilepath = Application.persistentdatapath +"/towerdefensedb.sqlite3";4 Public Static stringDbconnectionstring ="Uri=file:"+filepath; 5}
1 if(!file.exists (config.filepath))2 {3 //If the database file is not created, the database file is created.4WWW LOADDB =NewWWW ("jar:file://"+ Application.datapath +"!/assets/"+"Towerdefensedb.sqlite3");5 while(!Loaddb.isdone)6 {7 }8 file.writeallbytes (Config.filepath, loaddb.bytes);9 } Tenconn =NewSqliteconnection (config.dbconnectionstring);
Here is the normal operation code of the database, I do not write more here
Unity released Android cannot read the database under the Streamingassets file