Best data Class for storing stats.

Hello everyone, this is a bit more theoretical and discussion oriented than other questions. I will still try to make it “answerable” though. I am making a game where the player and ennemies are made up of a bunch of pieces that individually have stats. I am trying to figure out the best way to access, process and store these stats. Right now I work with a dictionary, but it is tedious. I think a Stat Class will be better, but I want to make it future proof. What would you guys use? How would you create that class? And would you recommend any article/guide?

Requirements:

  • Easily access and process many datasets.
  • Fast copy.
  • Can save and load from harddrive (fast).
  • Can process the entire data set (like average with another dataset or do calculations, probably through operator overload).
  • Easily create an empty set.

I do not need sorting (no quicksort or anything like that).

Thank you for any help. I know this isn’t as precise as suggested for Unity Answers, but it is extremely important to get right.

You could use the System.DataSet class.

It works like an in memory database, you can use tables, SQL queries etc. The data can be read/saved as XML. You will need to include System.Data.dll into unity, grab it from the Mono installation.