Unity releases Android Unable to read database under Streamingassets file

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.