![]() You can then assign these assets to inspector properties of MonoBehaviour's and thus assign them to prefabs or objects within your scene. This enables you to create "CreatureType" assets in the Unity editor which you can then manage in the Unity project outline like any other Unity asset. So you could create a class CreatureType : ScriptableObject. A scriptable object is a game-specific asset type. Solution within Unity: Scriptable ObjectsĪ solution completely within Unity would be to work with scriptable objects. But when the data is less than a couple hundred MB, I would look for a solution which loads all the data when the game starts and then allow the game to access it directly. The only exception would be if I had so much data that it won't all fit into RAM. ![]() I would generally not use a SQL database (not even SQLite) for handling static data in a singleplayer game. will be easy to manage and maintain for the codebase and SQLite database.will keep changes between designers synced.will be accessible for game designers (who have little to no SQL experience, but willing to learn).I'm leaning towards using a visualizer tool like DB Browser for SQLite or SQLiteStudio, but the lack of cloud syncing might mean a janky solution with Google Drive or AWS. I've looked into Microsoft Access (and similar programs) but they seem to be geared towards making applications now and don't have much in the way of SQLite integration. DB tables are can be static or dynamic, and the implementation on the Unity side for the DB is not an issue.īefore writing this code I'm exploring other options. The maintenance of this will also be pretty annoying, as we already need to maintain the database schema and the code representation (Unity C#). However, to translate this into the database (SQLite) we'll need to write some code to pull the data, format it and put it into the database. They will be using it to populate all of the items necessary for the game, so it acts as a 'source of truth'. Many browser tabs died to bring you this information.I'm programming on a game that relies on a database for a lot of the creatures and items in the game (think Pokémon).Ĭurrently, we have a Google Sheet that the designers are making. This method gives you the freedom of knowing you will never have to wait for a critical code patch.Ĭoolness – doing it yourself makes you feel smart, and saves your cash for some other cool thing. ![]() This method uses code that is highly tested and in common use: no custom code.įreedom – if you use someone's pre-packaged solution, you are stuck with whatever version of SQLite they choose to support, and when they choose to support it. Reliability – the fewer authors involved in writing the code for your libraries, the fewer opportunities for bugs. This method uses libraries from just two trusted sources: Unity and SQLite. so file that someone else compiled and posted to a forum, you can't be 100% certain what code it contains. What I'm offering is the step-by-step process to do it yourself. And if you're looking for quick-and-easy, this isn't the article for you. There are paid libraries on the Asset Store and free resources on Github that advertise quick-and-easy SQLite setup. (It took me the better part of a week, trial, error, and a heap of outdated forum posts to figure out.) This article aims to save you the headache. As I found, setting up SQLite for Unity can be a bit of a headache, especially if you're not very familiar with native code plugins. SQLite is one of the most popular options for lightweight databases, so it's a great candidate for use in a Unity application when you want something a little more robust than a structured text file (JSON, XML, YAML, etc.) or C#'s serialized objects. I've got a step-by-step guide that will walk you through it. Hey folks, I was looking into using SQLite in my game but I didn't like the existing options out there, and it wasn't easy to set up from scratch. ![]()
0 Comments
Leave a Reply. |