Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Item Database: SQLite or code generation?

Discussion in 'Scripting' started by arcandio, Apr 9, 2013.

  1. arcandio


    Aug 30, 2009
    So here's the brief: I'm doing a large number of items. These items have names and values in an array of ints at the moment. I'm wondering if I should switch over to using a SQL database for my items for any particular reason. I generate my items' code using the same spreadsheet I balance them with, so that works pretty well so far. I'll eventually need query for ranges of equipment by value or stat, and by equipment type. Should I switch to SQLite? What are the advantages/disadvantages of both approaches?
  2. Oksana-Iashchuk


    Sep 10, 2012
    Hi arcando!

    Actually you need to think about pipeline of editing and integration. I'll recommend to use google tabels to make possible share work between gamedesigners and writers as well if you need to localize description you could put it to the save table row. so you row will be looks like: item_id, prefab_name, name_en, name_fr, name_gr, description_en, description_fr ..... Using tools like SQLiteKit you will able to import it from google to local database within a click. so as result in you product you will have item in one place to edit for every one in team, and it will painless update.

    about resources it really important to understand that it can't be stored in database because Unity has build-in reimporting and managment - you could see that when you add new resource file it do import (it actually even change format specialy for audio and textures) So if you gonna use resources from database base you will loose performance and memory on device as well.
  3. CahMan


    Apr 3, 2013
    Hi Arcandio,

    Forgive me, but I'm not sure if I follow your question. Are you planning to use the SQL database to manage and edit game assets offline, or are you wanting to use an SQL database to connect with the game, while it's running, and store a players inventory?

    In general, I'd say that an SQL database is WAY overkill unless you need to handle millions of items.

    One of the nice things about SQL: its declarative instead of procedural statements (so you just tell the computer you want, say, every item that cost more than $100 instead of checking every items price and grouping the ones that are over $100). BUT you can do declarative programming using the LINQ library in C#, which is what I would recommend doing.

    Hope That Helps!