Tutorial on Database Management in Unity 3D version 5 using SQLlite

Hi Folks,

Most of us are aware that any software development project have “data” as its blood, without relying on data we cannot build softwares or applications.

Unity being primarily a game development engine, we can do various other development on technology like Virtual Reality Applications, Augmented Reality Apps, 3D supporting view apps, Educational Apps, Health realted device apps, military training real time softwares, Virtual Devices Applications, and ofcourse Games on all platforms.

Building application require database support, such as static and non static(realtime) data. We all know that player scores, game level progress saving functionality, data streaming through Web-GL or Unity WebPlayer, The data such as (integer, string, boolean) we can save in Unity using its PlayerPrefs Class. However, if we want to serialize data over web, we can use json, xml, etc. Hence, the data which is stored in the app can be saved using its PlayerPrefs class or json,xml.

Let us consider that if the data is large and gives the user the right to show(select), edit(alter) and delete and update records commands like we do in our mobile applications and web applications then what technology of database support we rely on Unity engine platform for our application?. The data which have large and huge data like mysql and microsoft.db. Unity does not support execution of mysql and microsoft.db connectivity (inbuilt) yet.

Hence, after a thorough research and developing application for a project (car Simulator System) I have worked on recently, I would like to share my experience and tips for the fellow game developers. A good news is that i realised that if we want to build mobile application which thoroughly relies on stored data in the application and gives features as alter, update, show and delete for a large record having complex relations in the database. So, in order to build data related applications, Unity can also be an option, so its no longer only for game development but for almost all platforms and technology. Unity 3D gives a platform for development for almost all technology related applications.

I remember, during college third semester subject as Android Mobile Development, we(my team mate Manas Mehta) developed “Programmers IQ” application for the subject. We developed adroid apk using android native ADT tool in Eclipse.We got the second highest(2nd Rank) for the project in our semester for the subject. We promised 0ur teaching faculty(Miss Gayatri Venugopal) to publish it in the market after our course and ofcourse removing few bugs as she liked the design and its concept for education. But my dream was to be a game programmer and not native android developer. So I never worked too hard that time but now it made me realise that we can create mobile applications which rely on database and develop using SQLlite technology using Unity. So I will fullfill my promise and publish by 20th December 2015.

In order to manage large data and complex queries to show data which depends on relational database, operators, Clauses, order and group of data stored in various tables of database, we can certainly use SQLlite plugin in Unity and perform all the operations as supported for other native applications for android, Ios, windows and web technology.

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is one of the fastest-growing database engines. The source code for SQLite is in the public domain. You can learn SQLlite from SQLLite Tutorial 

Please Note: In order to do complex exectution of slq queries in the database, one should have the knowledge of RDBMS and mysql query commands.

Following is the step by step easy tutorial for database integration using SqlLite in our application on Unity3D Engine framework.

  1. Download Sqllite browser management tool. For eg: search SQLlite Manager tool for mozilla firefox, google chrome. etc. This tool is the best tool which you can do all operations on a database using its UI and hence we do not need to depend on writing sql commands to execute our queries. We can create database, table. add,modify, delete and update records. and run queries in the tool itself to test the results. Great part is its a visual tool to show you everything related to your database opening in your browser itself, easy to adopt and develop apps.
  2. Download the required plugins for SQLlite to be added to our Unity Project. Please note that you need to download the 32bit and 64bit plugin as required by your system configuration respectively. Below are the links: SQLLite 32bit plugin and SQLlite 64bit plugin
  3. Integrate SQLite for the Unity project.
    1. Create a Unity 3D project and create a new folder “Plugins”.
    2. Copy and paste all the files in SQLlite32bit or SQLlite64bit respectively zip linked in the Plugins folder.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s