I’m currently working on building 3D KPI dashboards in Unity to work with Microsoft Hololens. However, I can’t seem to find any proper docmentation about the best-to-use database type for this application. All database-related questions are about score-keeping. I’m currently thinking about using SQLite, as described here: Using SQLite Database In Unity3D 4.3.3f | W.G. Creative MEDIA Solutions . As I’m not that experienced in databases at the moment, I think using SQLite means that I will first have to convert all database files I import to SQLite format. Is this true?
What type of database would you recommend using for this type of application?
Update:
I’m currently using a SQLite database, and it works fine while within Unity with the method discribed in the link above. For UWP, iOS and Android however, support for SQLite has to be built in differently. I will update my question if I find out more. Currently, my code for opening and closing the database reader is as follows:
// Initiate database for using
string connectionString = "URI=file:" + Application.dataPath + "/WorldPopulation.db";
IDbConnection dbcon;
dbcon = (IDbConnection)new SqliteConnection(connectionString);
// Open connection to the database
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = "SELECT Region, Value, Unit FROM Population WHERE Year == 2014 ";
// Executing database reader
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read())
{
string region = reader.GetString(0);
rawValue = (float)reader.GetInt32(1);
unitValue = (float)reader.GetInt16(2);
for (int i = 0; i < regions.Length; i++)
{
if (regions *== region)*
{
regionId = i;
}
}
populationVal[regionId] += rawValue * unitValue;
}
_ totalPop += populationVal ;_
* }*
for (int i = 0; i < regions.Length; i++)
{
_ //Debug.Log (populationVal*);
populationPerc = 50 * (populationVal / totalPop);
Debug.Log(populationVal + " " + i);
}*_
// clean up
reader.Close();
dbcmd.Dispose();
dbcon.Close();
Hello! this code works in android? I am with very difficult to make a database in unity works in mobile devices. Thank you. Please, if you know something this will be a big help.