Unit Data in a Strategy Game

Hello people,

I’m working on a turn-based strategy game at the moment and I’m looking for the best way to store complex unit data. I’m using a basic unit class and one xml file per unit, and every time I instantiate one, I fill the Unit class with the xml data.

Is there a better alternative to xml files for this purpose (I’m worried the loading of xml files might affect the games performance)? What is your preferred way to manage unit data in a strategy game?

Scriptable Objects

The ScriptableObject class defines objects that’s stored in your Unity project. They have a bunch of advantages over XML:

  • They’re directly importable. You don’t have to use XML parsing libraries or write your own parsing code to create a usefull wrapper for your data - you just grab them as an object from the Resources folder, or link them to a prefab that uses them in the game, and you’re good to go.
  • They’re stored as text files in the YAML format, which is a lot easier to read than XML files, and behaves much better with source control.
  • You can write custom inspectors for them just as easily as you write custom inspectors for MonoBehaviours, so it’s a lot easier to create powerful tools to work with your data - either by selecting the scriptable object and fiddling with it’s values in the inspector, or by creating larger editor windows that lists a lot of them.

Scriptable Objects are provided by Unity to let you work with stored data easily, so I recommend that you use them over xml files.

Hello Yaza, I also like you are fond of creating a turn-based strategy. How can I contact you? I want to ask you a few questions,Hello, Yaza, I am also interested in creating step-by-step strategies. how can I contact you on social networks???