Storing item information in a game

Probably a noob question to ask but anyway:

If I wanted to store the information of every item in my game how would I do this? Some sort of database with all the information of each item and then reference it whenever it needs to be accessed? (when the player picks up/crafts something)

It depends a bit on how you plan on structuring your game, and what kind of game it is.

If you have graphical representations of each item in your game (and this isn’t a network-heavy game), you might as well store this data with the graphics in a prefab. This way, your game objects and all values that represent them are encapsulated in a single location. If someone selects the “Cherry” prefab, they can place it, modify the graphics, or adjust the properties in one place.

If there is not a representation in-game (abstract representation of items or something), then it might be better to store this data externally in some sort of database. I’d use the term “database” lightly, since you could simply use text files with some type of formatting, whether that is key/value pairs, XML, JSON, YAML, whatever. There are a lot of benefits to plain text files: they are simple, light-weight, and anyone can edit them.

However, it would be possible to do some SQLite bindings and actually store this data in a database…might be overkill for your needs though. If you are storing all the item data on a server and want people to access the server to get properties, then using MySQL for item data would be totally appropriate.

So…depends a lot on how you want to structure your game. If you are new to Unity and plan on making a single player game of some sort, option 1 is the best way to get started.