Adding Items

Opening your Catalog

In the Catalog Browser window, select the edit icon next to your catalog name. This will open a new window, which shows the contents of your catalog.

If this is a new catalog, you will see an empty table inside the view.

Create a new Item

In the catalog window, use the toolbar to select New, then New Item. Once done, DataMaster will generate a new item within your catalog. By default, it will place the asset file inside a Data directory next to your catalog’s definition .cs file. You can move files anywhere you’d like, as mentioned here.

Once created, the item will appear in your catalog view. It will be given a default name. If your catalog window’s toolbar has Show Inspector enabled, then you will see an inspector view at the bottom. If not, you can use the default Unity inspector. For more details on the inspector, see Docking the Inspector.

Because this catalog is new and has no fields defined, your inspector and table view will be pretty empty. By default, all DataMaster items will have name and Icon fields that you can use.

New Item (Empty)

Adding fields to your catalog

With the new catalog created, we can begin adding fields to it so we can start defining our data.

To define fields within your catalog, open up the generated .cs file. The file can be found in the new folder that was created when you created your catalog in the previous section.

Your generated catalog file will look similar to the text below.

using UnityEngine;
using System.Collections;
using DataMaster;

public class MyNewCatalog : DataMasterCatalogItem {

}

To add fields to your catalog, simply add public fields to this class. For example, we can add some strings and prefab fields by doing the following:

using UnityEngine;
using System.Collections;
using DataMaster;

public class MyNewCatalog : DataMasterCatalogItem {
    public string Description;
    public RPGEnemy EnemyPrefab; // Assuming your game has an RPGEnemy script! (Just for example.)
}

As a further example, look at the example located at Examples/02 - Game Settings in the catalog PlatformerLevelData. The catalog definition there has the following definition:

public class PlatformerLevelData : DataMasterCatalogItem {

    public int NumberOfWaves;
    public int EnemiesPerWave;

    public int GoldReward;

    public List<ExampleRPGMonster> MonstersToSpawn;
}

Notice it adds three integer fields, and one list of monster prefabs. You can see the resulting catalog window below.

New Item (Empty)