Best practice for storing template data plus character data?

I have a mobile project I am working on that involves a lot of data and I am stuck pretty much at the start because I want to iron out the way the different pieces interact before trying to force a square peg down a circle hole.

The type of data I am working with is as follows:

  • Player

Player owns characters, a rpg party essentially. These characters are based on templates that hold name, base stats, and various types of data. The player will also have data related to what they have done, ie quests completed etc.

  • Character

Each character will be pulled from their template which says when they unlock certain things and how their stats will progress. Essentially storing a list of characters as they are by default.

Pretty standard information for a game. I’ve mostly only made quick games that were one scene and more arcade style so I’m in new territory for the most part.

Ways I’ve considered storing this data:

  1. Storing them in an empty game object (Database) in a list for each category. Each character, monster, etc would be a gameobject setup as they would be at default. Once the player owns something it would become an object childed to them, a copy that is. This feels like a crude way of storing data.
  2. Storing the data in a script for each. (Ex. Monster1.cs, Monster2.cs) and mapping it onto a template “character” This seems like the best way? Feels like it would be a lot of script clutter though.
  3. Storing data in a type of text database and pulling it from templates and writing to the playerprefs.

Am I on the right track here?

In case anyone finds this later or cares to know the answer I came to. I found a Unity video from the main site that covered data persistence. I will be attempting serialization in order to save and load my data, the fun part now is making a system that fits everything I need.

Player prefs is too easily accessible to store data that players could easily change. They also are very limiting in the type of data that you can store.

An external database does not have any official support that I can tell from Unity but it is a possible solution, so long as you know what works best in your coding language.

Overall, serialization lets you store gameObjects and by using a save/load mechanic the data can be retained between sessions. Additionally, by using DontDestroyOnLoad the object can persist across scenes so that you don’t have to reload the character and other data between them.