SQLite4Unity3d 本地数据库

2020-6-10 雨辰 Unity3D


What's this?

When I started with Unity3d development I needed to use SQLite in my project and it was very hard to me to find a place with simple instructions on how to make it work. All I got were links to paid solutions on the Unity3d's Assets Store and a lot of different and complicated tutorials.

At the end, I decided that there should be a simpler way and I created SQLite4Unity3d, a plugin that helps you to use SQLite in your Unity3d projects in a clear and easy way and works in iOS, Mac, Android and Windows projects.

It uses the great sqlite-net library as a base so you will have Linq besides sql. For a further reference on what possibilities you have available with this library I encourage you to visit its github repository.

*Note: SQLite4Unity3d uses only the synchronous part of sqlite-net, so all the calls to the database are synchronous.

If you want to know more about why I created this plugin you can read more here.

The fast track

All you have to do to start using it in your project:

  1. Download this zip, extract its content and copy the resulting folder to your Assets/Plugins folder. It contains the dlls that Unity3d will need to access sqlite.
  2. Copy the SQLite.cs file into your scripts folder.
  3. Don’t forget to copy your SQLite database file in your Assets/StreamingAssets folder if you’re shipping one.
  4. You’re done! Now you can get access to your database using sqlite-net. ;P


If you want to try it I've uploaded a small example that you will be able to find in the "Example" folder. Download the folder and open it with Unity3d to give it a try. It contains classes that will help you to start.

Android particularities

Android configuration and deployment is very straight forward. Take a look at the following video if you want to get a picture on how to proceed:


iOS particularities

As you may know iOS doesn't allow JIT compilation so, generally speaking, you will have to be very careful when you use reflection in your code. For a more deeper explanation of this issue please refer to Google but making it short: you cannot create dynamic objects using reflection. How is this affecting SQLite4Unity3d? Well, prior to this version you couldn't use very complicated queries. Now, for basic queries you will have iOS support. In case you stumble uppon a JIT compilation error it's time to use the old sql syntax.

Check this video to know how to proceed with iOS deployment:


Windows particularities

In general you won't find any issues with Android and iOS. For Windows versions, please take a look at the the video below for more details on how to proceed:



This project is based on the work of:

标签: Unity3D-优化性能 Unity3D


2021-06-04 21:51
<a href="http://www.nicolezangara.com/gray-animal-print-buty-tenisc">gray animal print buty</a> <a href="http://www.jvbowl.com/gr%C3%B8nn-wrap-mini-kjole-kjoleb">gr酶nn wrap mini kjole</a> <a href="http://www.dchamberlin.com/ketten-umh%C3%A4ngetasche-tasched">ketten umh盲ngetasche</a> <a href="http://www.altaimplement.com/felpe-nike-bambino-zalando-tutab">felpe nike bambino zalando</a> <a href="http://www.laukemperauto.com/nike-tuned-1-gris-homme-chaussures1">nike tuned 1 gris homme</a> <a href="http://www.autofusionny.com/jordan-retro-12-teal-y-negro-zapatos1">jordan retro 12 teal y negro</a>
altshiftkill http://www.altshiftkill.com/
2021-05-25 04:55
<a href="http://www.chscbd.com/maglia-nike-bambino-tutab">maglia nike bambino</a> <a href="http://www.vivianrao.com/adidas-tango-indoor-soccer-chaussure-chaussures1">adidas tango indoor soccer chaussure</a> <a href="http://www.saltyskitchen.com/nike-air-jordan-1-bajo-university-oro-zapatos1">nike air jordan 1 bajo university oro</a> <a href="http://www.proachriot.com/resist-tutti-cowboy-cappelli-cappellod">resist tutti cowboy cappelli</a> <a href="http://www.icebeamgames.com/olcs%C3%B3-puma-golf-cip%C5%91-sneaker5">olcs贸 puma golf cip艖</a> <a href="http://www.sensepeanut.com/sexy-piros-midi-ruha-ruhakb">sexy piros midi ruha</a>
tatilblogu http://www.tatilblogu.com/
2021-05-08 18:53
<a href="http://us.oetopia.net/automotive-blower-motor-wheels-ame">automotive blower motor wheels</a> <a href="http://us.playper.net/boys-athletic-water-shoes-2-amd">boys athletic water shoes 2</a> <a href="http://us.acutechpiping.net/bady-disposable-diapers-3-ame">bady disposable diapers 3</a> <a href="http://us.warmte.net/womens-berets-ama">womens berets</a> <a href="http://us.nutrytec.net/womens-lingerie-panties-bikinis-ame">womens lingerie panties bikinis</a> <a href="http://us.legalwire.net/home-kitchen-storage-drawer-units-amc">home kitchen storage drawer units</a>
forstore http://us.forstore.net/
2021-05-07 14:44
<a href="https://www.robbsbooks.net/black-on-black-nike-shorts-shirte">black on black nike shorts</a> <a href="https://www.kabinenroller.net/nike-air-vapormax-flyknit-hyper-punch-shoes4">nike air vapormax flyknit hyper punch</a> <a href="https://www.theproton.net/gold-strappy-block-heels-bootsa">gold strappy block heels</a> <a href="https://www.wifizer.net/pink-shift-dress-for-wedding-dressd">pink shift dress for wedding</a> <a href="https://www.nomographics.net/unique-work-bags-bagsc">unique work bags</a> <a href="https://www.notallowed.net/denver-broncos-emmanuel-sanders-womens-navy-blue-nike-10-nfl-long-sleeve-t-shirt-name-number-logo-jerseya">denver broncos emmanuel sanders womens navy blue nike 10 nfl long sleeve t shirt name number logo</a>
visionitgroup https://www.visionitgroup.net/
2021-05-07 13:06
<a href="http://www.myecoschool.net/lillard-berretto-cappelloa">lillard berretto</a> <a href="http://www.gloriarosen.net/trendy-shoes-2019-bootsa">trendy shoes 2019</a> <a href="http://www.oribeleza.net/mammut-boulderschuhe-stiefeld">mammut boulderschuhe</a> <a href="http://www.gicamconseil.net/iphone-8-plus-hoesje-for-zwart-phone-hoesjea">iphone 8 plus hoesje for zwart phone</a> <a href="http://www.traficoayuda.net/mens-nike-cleveland-browns-95-myles-garrett-limited-brown-rush-vapor-untouchable-nfl-jersey-jerseyc">mens nike cleveland browns 95 myles garrett limited brown rush vapor untouchable nfl jersey</a> <a href="http://www.beepurehoney.net/torebki-with-rfid-protection-torebkid">torebki with rfid protection</a>
beginandend http://www.beginandend.net/
2021-04-29 12:40
<a href="http://us.freetabletop.com/girls-robes-7-amc">girls robes 7</a> <a href="http://us.gruenistleben.com/baby-girls-robes-5-ame">baby girls robes 5</a> <a href="http://us.velcovsky.com/home-kitchen-under-cabinet-mounting-accessories-amb">home kitchen under cabinet mounting accessories</a> <a href="http://us.jardinenscene.com/home-kitchen-kids-room-d%C3%A9cor-accents-canopies-amc">home kitchen kids room d茅cor accents canopies</a> <a href="http://us.mardoleste.com/automotive-mounting-kits-ama">automotive mounting kits</a> <a href="http://us.tbtphilly.com/womens-shrugs-7-amb">womens shrugs 7</a>
2021-04-29 02:35
<a href="https://www.umccadillac.net/cris-carter-mens-limited-white-jersey-nike-nfl-minnesota-vikings-vapor-untouchable-road-80-jerseyd">cris carter mens limited white jersey nike nfl minnesota vikings vapor untouchable road 80</a> <a href="https://www.afroorganic.net/olive-green-converse-low-top-shoes4">olive green converse low top</a> <a href="https://www.webcix.net/bulls-23-michael-jordan-stitched-white-1985-all-star-mitchellness-nba-jersey-jerseye">bulls 23 michael jordan stitched white 1985 all star mitchellness nba jersey</a> <a href="https://www.forstore.net/knee-high-white-lace-up-boots-bootsb">knee high white lace up boots</a> <a href="https://www.dollycouture.net/davis-weekender-bag-bagsa">davis weekender bag</a> <a href="https://www.rinteenkulma.net/air-max-97-silver-womens-shoes2">air max 97 silver womens</a>
redprivet https://www.redprivet.net/


朱文华 joyimp|@2011-2021 京ICP备16030765号-2