- Home /
Unity Sqlite Database inaccessible after build
Hi I am using SQLite Database for my game I used below connection string:
connectionString="URI=file:"+Application.dataPath+"/Database/QuizGame.sqlite";
It worked in the editor but it didn't work after build.
So I moved the DB to a fixed path and my connection string as: connectionString="URI=file:C:/DB/QuizGame.sqlite";
Its working now.
But I don't want to place it outside the game data directory because its doesn't make sense. It should be relative to the game directory.
If anyone has an idea please help me . Thanks in advance!
Answer by Vixxd · Sep 26, 2017 at 10:36 PM
I am having the same problem - it creates an empty copy of my database in the output folder rather than using the one included within the Unity solution. I would prefer not to hardcode the location.
Answer by Animatick · Sep 26, 2017 at 11:01 PM
As long as you use a persistent data path to create the database, it will automatically find the database wherever you save it, which is usually outside of your project. Are you using the SQLite database for Android or Windows? Usually, a SQLite database is used with Android, that's usually what I use them for anyway.
Answer by Mrhiga · Jul 14, 2019 at 07:06 AM
Creat a folder and name'it "StreamingAssets" and put your database file in it it will work,I am having the same problem,until i make a folder named "StreamingAssets" and i placed the bd file in it and it work no empty file. in unity you must name the folder StreamingAssets in order to export some file are not from unity default file extension.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
I cannot get my project to build for PC 1 Answer
Build only script error 1 Answer
Lighting is not working after building for PC. 0 Answers
Can someone take your source code from an iOS build file? 1 Answer