- Home /
 
Any solution for NoSQL, local database, C#, compatible with Unity?
I want to use a noSql database to store some data on local disk. I don't want a WEB server, or to install any service database like MySQL/MSSQL Server, and no junk sql code like "select a.a, b.a from a inner join b..." messing with my code. What could I use?
Answer by Bruce3D · Jul 01, 2018 at 04:06 PM
A stable C# nosql solution iBoxDB http://www.iboxdb.com
Answer by $$anonymous$$ · Dec 08, 2016 at 02:42 PM
Have a look at scriptable objects, they are like data container objects. Should really be good enough for what you're looking for.
I've found one called SIAQODB: "...a NoSQL embedded object and document database engine that currently runs on .NET, $$anonymous$$ono$$anonymous$$ac, Universal Windows Platform (UWP), Xamarin.iOS, Xamarin.Android, Xamarin.$$anonymous$$ac and Unity3D. "
It's free if you store less than 100 objects per type/table, so it works for what i need. There's a Database $$anonymous$$anager that unfortunatelly I can't run to edit the database outside Unity (error with x86 / x64 version of the database file and the manage application), I'm looking for a solution on the siaqodb forum.
The basic usage is:
 using Sqo;
 class $$anonymous$$yDatabase : $$anonymous$$onoBehaviour
 {
   void Start() 
   { 
       var db = new Siaqodb(Application.dataPath + @"\databaseFolder\"); 
      db.StoreObject(new Foo("$$anonymous$$az", 26);
      print(db.LoadAll<Foo>().Count);
   }
 }
 
 public class Foo
 {
   public string Name {get;set;}
   public int Age {get;set;}
   
   public Foo(string name, int age)
   {
     this.age = age;
     this.name = name;
     }
 }
 
                  But I'm still looking for other solutions to compare. I will take a look about Scriptable Objects ( I've never had to use them before).
Answer by markmeeus · Mar 19, 2017 at 07:07 PM
Hi @KazYamof,
I'm the author of MarcelloDB (http://marcellodb.org) which is an embedded nosql database. It should be a good fit for your use case.
Below is the example as for siaqodb, ported to marcellodb.
 class MyDatabase 
 {
     public class Foo
     {
         public int ID { get; set; }
         public string Name { get; set; }
         public int Age { get; set; }
         public Foo (int id, string name, int age)
         {
             this.ID = id;
             this.Age = age;
             this.Name = name;
         }
     }
     void Start ()
     {
         var dataPath = Application.dataPath + @"\databaseFolder";
         var session = new MarcelloDB.Session(new MarcelloDB.netfx.Platform(), dataPath);
         var foos = session["data"].Collection<Foo, int>("AllTheFoos", f => f.ID);
         //persist
         foos.Persist(new Foo(1, "Kaz", 26));
         //enumerate
         foreach(var f in foos){
         }
         //find individual item:
         foos.find(1);
     }
 }
 
              Hi @markmeeus, I'm trying $$anonymous$$arcelloDB in my Unity app, but it is a pcl (so it targets .net 4 or higher) do I have to refactor it to compile .Net 3.5 or should it "just" work if I add the dll as a plugin?
regards!
Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Store data for tile based system 1 Answer
Storing my choose your own adventure questions/actions 1 Answer
What is the best way to create and store levels in Android game. 0 Answers