Hi! I’m making an educational game that’s sort of like a quiz game but with tutorials. I’m using mySQL(online server) as my database and I’m gonna store the questions in there. Since the game is only offline:
How can I save the questions from the database to Unity so I don’t have to connect to the internet to get the questions from the database?
If I add new questions to the database, how can I update it in Unity?
In the future I suggest if you have 2 questions, ask them separately.
None the less, I’m going to answer both your questions.
There are so many ways to save data in any application, and that is really dependent on your platform.
If you are building for desktop (or mobile), you can simply save (text) files or have all your data in the registry. Either way is good (however I prefer txt files XD)
If you are building for the Web. The only real way of doing it (The only way you should) is by creating cookies. However you could (please don’t) create a plugin that does it as well.
As stated in my comment, you never directly access the database server (you shouldn’t even be able to get it’s IP)
I suggest making a Web Server that accesses the database server for all your questions. I then suggest, that ever time you add or change any data, a certain variable on the server gets changed. In the user data you also have this certain variable. Every time you want to update the client data, the client requests this variable from the server. Only if they do not match, does the client update.
As for the server, I suggest building it in either Python, Ruby or Node.js. If you are familiar with Unityscript, making a Node.js server shouldn’t be too difficult
Now I would like to address your question. To be honest, this has been asked (and answered) before. You can probably get many answers through a simple google search and get the information you want.
In the future, I suggest asking more precise, less opinionated and more detailed question.