Just to give a quick background, I’m a web programmer who is completely new to game programming / Unity as of 4.3.
Basically the game I’m working on has points where the player is asked certain questions and given a chance to select one of the pre-programmed answers (there can be anywhere from 2 to X possible answers for each question.) The game will determine what questions to ask at any given point based on whether the player meets certain prerequisites for that question to be asked… these prerequisites are based on certain elements such as how much XP the player currently has, how much money they have, etc.
So for instance let’s call this question #1. This is the data I’d need to store…
ID #: 1
Question: Would you like to purchase housing?
Prerequisites: 10,000 XP, $50k in cash
Answers: A. Buy a $400k house, B. buy a 200k condo, C. rent an apartment at $750/month, D. live on the streets
Player choice: (NULL until player gets this question, then stores the option they chose)
Maybe some other fields I haven’t thought of yet?
There will probably be a good 100 or so of these questions. So basically, for each id # there are fields that have a 1 to 1 relationship (question text and player’s choice) and fields that have a 1 to many relationship (potential answers, prerequisites.)
If I were making a web app I know exactly how I’d manage this… with a MySQL database. Create a table that holds the question id #, question text, and any other fields with a 1 to 1 relationship, then build a few other tables for the 1 to many relationships. Whenever I need some questions just run a query on the database using the prerequisites and such. Simple.
But I’m not sure if this is the best approach in Unity. I’ve searched around a bit and it seems there is hesitance to use databases with Unity? Maybe there is a better way? I thought about arrays but that could get very messy depending on how many fields I end up with and the 1 to many relationships and such.
Ideas? Suggestions? Etc.?