- Home /
Sqlite4Unity3d difficulties
Hi guys!
Does anyone know how to get Sqlite4Unity3d to work with Android? I followed the instructions to the letter but my database fails to appear on my android device. First, I put the Plugins folder in the Assets folder. Then I put the SQLite.cs script in the Scripts folder. My database file is in the StreamingAssets folder. That's all that robertohuertasm suggests doing on his Github page (https://github.com/codecoding/SQLite4Unity3d).
Is there something obvious I'm missing? Thanks for any help! :)
Answer by Gilead7 · Mar 28, 2016 at 10:50 PM
First question: Is the information on that database something static or does it change. Example- you have a mobile game with a bunch of items for a store that you pre-made and want to transfer to the device or is this data something the user will create? Example- your player's stats.
When you did your build settings, did you change it to Android?
Hi! Thanks for your reply. The database is static. It is a database of questions and answers for a trivia game. Yes, I changed the build settings to Android. I have an apk. All is working apart from the fact that the questions and answers are not showing. They show well on my pc. One thing I should add is that I tried the Example given by roberto huertasm, and that works fine on my android device. I'm not sure what I have to do for my own game to work on android. Thanks! :)
If the database is not porting over, you may need a script to create the database and populate it at the main menu or something on the device, then use a singleton pattern for all your db calls. Hope that helps!
Thanks anyway! :) If anyone else has an idea too I'd be grateful! Cheers! :)
One more question: Can you confirm that all I had to do was putting the plugins in the plugins folder and putting the SQLite.cs script in the scripts folder, and the database in the Strea$$anonymous$$gAssets folder? Or is there more to do, like writing a bunch of code? How does my main script get the database to function in android as opposed to Windows?
Hope this makes sense! Thanks! :)